How do I fix this error?
None-of-your-business@penguin:~/None-of-your-business$ x86_64-w64-mingw32-gcc -o bin/EreecliseWin64.exe src/main.c
src/main.c:4:10: fatal error: GLFW/glfw3.h: No such file or directory
4 | #include <GLFW/glfw3.h>
| ^~~~~~~~~~~~~~
I tried this.
None-of-your-business@penguin:~/None-of-your-business$ x86_64-w64-mingw32-gcc -o bin/EreecliseWin64.exe src/main.c -lglfw3 -lGL -lX11 -lpthread -lXrandr -lXi -ldl -lm
src/main.c:4:10: fatal error: GLFW/glfw3.h: No such file or directory
4 | #include <GLFW/glfw3.h>
| ^~~~~~~~~~~~~~
I have GLFW installed
Your command is a short form that combines both compiler and linker step:
For troubleshooting purposes and overall clarity during the build process I recommend you split this in the 2 seperate steps, like this:
The first line above is the compiler step, and you should add the compiler flags needed for glfw3 to it. If everything is properly installed you should be able to get these flags by running
pkg-config --cflags glfw3.The second line above is the linker step, and you should add the linker flags needed for glfw3 to it. If everything is properly installed you should be able to get these flags by running
pkg-config --lib glfw3.If
pkg-configdoesn't work, either try by pointingPKG_CONFIG_PATHto the path containingglfw3.pc(e.g.PKG_CONFIG_PATH=/usr/lib/pkgconfig/glfw3.pc), or specify the flags manually like this:Replace
/usrin the examples above with the proper location of your installation of glfw3 for the x86_64-w64-mingw32 platform.If you're cross-compiling (targeting Windows while building on Linux) it's important you have and use a Windows build of glfw3.