Important: Please read the Qt Code of Conduct -

[Solved] On Qt 5.2.1 with QT Creator, I get an error of cannot find -lGL when I compile.

  • I have installed Qt 5.2.1 by downloading and using the Qt online installer for Linux 32 bit on a Xubuntu 32 bit virtual machine. Qt Creator runs but when I tried to compile the app it gives some errors. First it gave the error of no compiler and I installed g++ to fix that error.

    Now it gives "cannot find -lGL" so this appears to be a linking error so I am guessing I am missing some other support files.

    So my questions:

    1. Why did the online installer not detect if everything was installed and install it or give me a list of things to install?
      (IE should this have worked and did I just miss checking some option? If so let me know and I can try installing again.)

    2. Since the installer did not do it ... where is the list of what is needed to use Qt?
      I have seen this page
      and it gives a list of packages if you are building from source. So do I need all of these packages to use Qtcreator?

    3. Since I am just using a virtual machine, I can easily try a different distro instead. So is there a distro that works correctly with the Qt installer so I can just run it and have everything installed?


  • Lifetime Qt Champion


    This one is a classic, you need to install the opengl library developement package.

    1. The installer can't detect that since there are numerous distributions that have their own package management.

    2. "Here": you have a good list of what you might need depending on which module you will use.

    3. Technically all can work provided they are recent enough. The missing dev packages depends generally on what you develop before so it's a one time setup you'll need to do.

    Hope it helps

  • Looking at the link you provided, it was not clear to me what exactly I needed to install.
    So I installed libcogl-dev and libcogl-gles2-dev and now it works.

    Thanks very much.

Log in to reply