I'm having a hard time trying to install Qt on linux. I downloaded the .run file on the website and installed Qt. However, when I try to compile the default Hello World project using Qtcreator, I get the following :
error cannot find -lGL
I was able to solve the problem by issuing the command :
sudo apt-get install libqt4-dev
But, I'm not satisfied with the solution as I want to use Qt5 and the name of the lib I downloaded implies version 4. Can someone explain what is going on and tell me if my solution is correct? If not, what should I do to get a working Qt on Linux.
Additional question
The correct answer, as provided by LtWorf, was to install libgl-dev. For future problems of this sort, can someone tell me how I should have guessed that I had to download this particular library? And why are there some libs with -dev at the end? What do they provide?
3) Run the Qt installer run and is likely located in your ~/Downloads directory. Use chmod +x qt*. run to make the file executable, then run it by typing ./qt*.
Visit Qt downloads page an download a 32-bit or 64-bit Linux installation depending your version of Ubuntu. The installation file can be also downloaded through the command line using wget. This is valid until 5.14. 2 due to policy change, distributing Open Source Qt linux package is discontinue from 5.15.
That being said, under a Linux system we can simply use the following script to determine whether Qt is installed: if ! test -x /usr/bin/qmake then # The Qt library is missing... echo "error: This script requires Qt to be installed." exit 1 fi # The Qt library is installed ...do your thing...
Qt (pronounced "cute") is cross-platform software for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms such as Linux, Windows, macOS, Android or embedded systems with little or no change in the underlying codebase while still being a native ...
Well it is trying to link with libgl and doesn't find it. You should install libgl-dev.
-l
is a linker option, it tells the linker to use a certain library. For example you can have -lmagic
meaning that you want to use libmagic.
Normally all libraries are called libsomething, and on debian you will find 3 packages called: libsomething libsomething-dbg libsomething-dev
The 1st one is the library, the second one is the library compiled with the debug symbols, so you can make sense of stacktraces more easily, and the final one is the development package, it contains the .h files so you can link to the library.
sudo apt-get install libgl-dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With