Reputation: 165
I just start learning opengl and I started with GLFW library. And I download the "Windows pre-compiled binaries" from http://www.glfw.org/download.html. Then I unzip my file into C:\GLFW
And now I have a problem when compiling my code. I use mingw in command line, like
gcc main.c -IC:\GLFW\include\GLFW -LC:\GLFW\lib-mingw -lglfw3 -lglfw3dll -lopengl32 -lgdi32
It always show "fatal error: GLFW/glfw3.h: No such file or directory"
but if I change #include <GLFW/glfw3.h>
into just #include <glfw3.h>
in my code,
it compiles successfully.
But every tutorial shows me the former. Why?
If I put the header file and lib file into mingw's searching path, is there any different?
Upvotes: 0
Views: 7414
Reputation: 108
It is because you include directly to C:\GLFW\include\GLFW
, so there is no GLFW
folder in this directory. If you want to use #include <GLFW/glfw3.h>
, you will want to use this path instead C:\GLFW\include
.
To answer to your two questions:
#include <GLFW/glfw3.h>
or #include <glfw3.h>
?#include <GLFW/glfw3.h>
if you put it in the folder). I would not recommend this method, since I prefer to make an include
and lib
folder into my project directory. If you want to do more research: http://www.mingw.org/wiki/includepathhowto.Upvotes: 3