Error when compiling on linux with glfw

Error when compiling on linux with glfw
0.0 0


I hope this is the right place to report this, since I couldn’t find where to report issues.

I tried to compile a project on my Fedora Linux distribution after installing all the dependencies. I ran into an error with glfw. When doing some digging, I noticed that glfw recently released a new version glfw3 and stopped supporting the old. glfw3 has some major differences with the previous version, most obvious that they changed the name of glfw.h to glfw3.h. But also a lot of changes with the inner framework. In short the current cocos2d it is not compatible with the new glfw3.

They released I guide that could aid in the transition here:

I hope you can fix this quickly, best regards Matthijs


Thanks for sharing. Unfortunately the most changes are just function renaming, and glfw 3 still is not added to next ubuntu release, 13.10. Btw, which Fedora version you are using and which libraries except glfw3 it have? Does it have glfw2, sdl2?


Fedora 18. It does have sdl2. But ont glfw2 so that’s the problem I have now, I can’t go back to the old. I did try to install the glfw legacy version manually, downloading the source from github, but I still got undefined reference errors to functions of glfw.


You can link library with libglfw2, [1] says that you can just edit find string
SHAREDLIBS += -lglfw -lGLEW -lfontconfig -lpthread -lGL
and replace with
SHAREDLIBS += -Wl,-soname, -lGLEW -lfontconfig -lpthread -lGL

About moving to next version: renaming API calls without changes is bad practice, so I suggest make optional SDL2 backend in addition to glfw2.



But I don’t have libglfw2 installed, as this error fatal error: GL/glfw.h: No such file or directory shows that there is no glfw.h. while when looking in my GL folder, there is an glfw3.h because I do have that version installed. Neither is there a in my lib folder. Only a, a and

I can’t install libglfw2 since only 3 is available.


I fixed it, I believe. I manually built the glfw2 library from here: using the make x11-dist-install command.
After that I renamed the created, which was placed in /usr/local/lib, to and I had to move it to my /usr/lib64 directory. Then I created a link from to

still changing the code in didn’t make a diffrence, so I did it badly and changed the link to point to instead of

But as you said, this is bad practice, so maybe there is something wrong in the code change that you profided.


For all folks looking for solution to this: