I'm attempting to setup my environment for Vulkan projects, and I'm running into issues with GLFW. I'm using VSCode and GCC on my system running Pop!_OS 22.04 LTS and I've installed GLFW using sudo apt install libglfw3 libglfw3-dev
. I manually checked the install location, which is in /usr/include/GLFW
, which I can confirm is included in my GCC include path.
I'm using this basic program to test that it installed correctly:
#include <GLFW/glfw3.h> // doesn't work with glfw3native.h either
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
However I get this error when attempting to compile:
g++ -pthread -o test main.cpp -lglfw -lGLU -lGL -lXrandr -lXxf86vm -lXi -lXinerama -lX11 -lrt -ldl
main.cpp:1:10: fatal error: GLFW/glfw3.h: No such file or directory
I'm truly stumped. Here's what my GCC include path looks like:
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/11/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "<stdin>"
And here's where GLFW is located:
~$ locate glfw3.h
/usr/include/GLFW/glfw3.h
If there's a blatantly obvious error with my configuration I'd love to know,