Qt debian/ubuntu: Can't compile, error: cannot find -lGL

c++, debian, opengl, qt, qtgui

Solution

Since this is a linker error, you may have one of two problems:

- You don't have libGL installed

- libGL is installed but not in your system path.

If libGL isn't installed, you can install it:

`sudo apt-get install libgl1-mesa-dev`

I think is the right package. I don't have a debian machine handy so I can't test it.

If you have this package installed, you need to add it to your system path. You'll need to append it to environment variable `LD_LIBRARY_PATH` or make a `.conf` file located in `/etc/ld.so.conf.d/`.

Again, I don't have a debian machine to verify these paths, but that's the best I can do from memory. Either way, this should be enough information to get started.

Good luck!

Problem

I have a problem building applications in Qt on Debian. When I try to compile anything I get: `/usr/bin/ld: cannot find -lGL collect2: error: ld returned 1 exit status make: *** [test] Error 1 14:38:52: Proces "/usr/bin/make" zakończył się kodem wyjściowym 2.` Last line means: `Procces(...)` exited with code: `2` Any idea what's wrong?

Original source