0

I want to start using OpenGL on Qt Creator, using Ubuntu 16.

I have downloaded glfw-3.2, used cmake and then make.

I have included in my file and Qt Creator finds it just fine.

However I get the errors "Undefined reference to glwfInit" etc and same thing for all the functions of the library.

After searching the web I think it is a linking issue and thus I have added in my .pro file the line LIBS += -lglfw3 but then I get the error "cannot find -lglfw3" .

My guess is that since I have downloaded the glfw-3.2 in my "Downloads" directory and not in the usual one, Qt cannot find the library.

So I tried to move it to usr/include/ but I encounter "permissionned denied" barrier.

My question is : how can I link against this library.

I want to add that I have no idea where this library actually is on my computer.. I cant find it in the glfw-3.2 file and thus it may not be installed at all but then how can I install it ? I believed the whole process I went through was to install it.

PS : I have spent hours browsing the web and I believe I have read every single page about this subject, however I often dont get what they explain... For instance, http://www.glfw.org/docs/latest/build_guide.html#build_link_cmake_source they explain that I need to change something on the CMakeList to build properly but it makes no sense to my newbie brain...

genpfault
  • 51,148
  • 11
  • 85
  • 139
Lauriane.C
  • 100
  • 10
  • Don't download the source (or even a binary precompiled library), use the Ubuntu packet manager to install the development package `libglfw3-dev` instead. Then the libraries and headers will be installed in the system directories and you can use them without specifying special paths. – Some programmer dude Jul 07 '16 at 13:04
  • Ok so I did "sudo apt-get install libglfw3-dev" and as you said the glfw3.h indeed appeared at the right place which is /usr/include/GLFW/glfw3.h . However when I run my program I still get the same erros : "undefined reference to .. " Any idea ? EDIT : it works fine when I link LIBS += -lglfw Thank you !! – Lauriane.C Jul 07 '16 at 13:33
  • You do still link with the library? Also, the library you need to link with is not `glfw3` but plain `glfw`, so your `LIBS` line should be like `LIBS += -lglfw`. – Some programmer dude Jul 07 '16 at 15:37

0 Answers0