Why is the window not being drawn?

72 views Asked by At

When I run the code below, the window does not appear. There are no errors in the output.

// main.cpp
#include <GLFW/glfw3.h>

int main() {
  glfwInit();
  GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);
  while (!glfwWindowShouldClose(window)) {
    glfwPollEvents();
  }
  glfwDestroyWindow(window);
  glfwTerminate();
  return 0;
}
# CMakeLists.txt
cmake_minimum_required(VERSION 3.26)

project(app LANGUAGES CXX)

add_executable(${PROJECT_NAME} main.cpp)

find_package(glfw3 REQUIRED)

target_link_libraries(${PROJECT_NAME}
  PUBLIC
    glfw
)

OS: Arch Linux x86_64 Kernel: 6.5.7-zen1-1-zen WM: sway 1.8.1

~/ pacman -Qs glfw 
local/glfw-wayland 3.3.8-1
    A free, open source, portable framework for graphical application development (wayland)

I'm waiting for an application window with the name specified in the code on my monitor screen.

0

There are 0 answers