Hi,
I’m new to GLFW and wan’t to try some example code but I can’t compile any. My example c++ code has #include <GLFW/glfw3.h>
. I try to compile it with g++ ./test.cpp -lglfw
. If i do so, i get the error:
GLFW/glfw3.h: No such file or directory
Already search with google but didn’t found anything what worked for me. Using Linux Mate 18.1.
I installed (sudo apt-get install) libglfw2, 3, 3-dev, 3-doc, -dev,
also libglfw-dev libglm-dev libglew1.13 build-essential libevent-pthreads-2.0.5 doxygen xorg-dev libglu1-mesa-dev
(i know its not the newest version of GLFW but I would like to start working with this)
Any idea what I need to do? Need to add some Path? where it is located? filesearch take ages…and find nothing
Thanks
On Linux the header files should normally be in /usr/include/GLFW
, but the compile error suggests that they are not there. Older versions of glfw were stored in /usr/include/GL
instead, in which case your include line needs to be changed to #include <GL/glfw.h>
.
Another possibility is /usr/local/include/GLFW
, but that is unlikely if you installed through a package manager rather than manually.
If you have locate
installed, try searching for them with locate glfw3.h
in your shell of choice.
1 Like
Thanks!
i had nothing in /GLFW but in /GL. There as you noted only glfw.h.
I tried locate (also thanks for that hint) without any result for glfw3.h. So I installed again. After this I have glfw3.h in /GLFW but nothing in /GL anymore. It seems it removes newer version if you install older. and older if you install newer.
Ok, now it can find the header. But I get some different errors like:
error: ‘GLFW_NO_API’ was not declared in this scope
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API)
and locate glfw3.h hast still no output
GLFW_NO_API was introduced in version 3.2: http://www.glfw.org/changelog.html
Do you have at least version 3.2?
If your distributions glfw is too old, then simply build glfw from latest release and link statically to it.
1 Like
Ah ok, good to know, thanks. It’s only version 3.
it was just example good, not sure if I need it. I will try other code which works with version 3 then first.
e.g. this one:
http://www.glfw.org/documentation.html
(glClear no reference, if i add -lGL it can compile (g++ ./test.cpp -lglfw -lGL)
ok. compiled without error
but if I start the program nothing happens. I instantly get back to console.
Edit: with apt-get I can only get version 3. Thanks for links but I would like to start with apt-get version. If I install something new other things can go wrong :). And program should also work on computer which have only version 3.
EDIT2: IT IS WORKING NOW
(for some reason I need to restart my PC first)
thanks all for your help
1 Like