Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Ubuntu Linux 13.and Qt 5.3 "cannot find -lGL" and "-lglut" even though I installed them



  • Ah, need a little help here.

    I'm a new to Linux and not exactly a wiz with Qt either.

    I've installed Ubuntu, and QtCreator with Qt 5.3.
    I've also installed OpenGL for development using
    sudo apt-get update
    sudo apt-get install mesa-common-dev
    sudo apt-get install build-essential

    When compiling my Qt Project, I get "cannot find -lGL" and "cannot find -lglut", even though I've added
    "QT += opengl"
    in my .pro file.

    any ideas where I'm missing something?



  • That is Ubuntu 13.04



  • Install opengl: @sudo apt-get install libgl1-mesa-dev@ for glut i don't know the package name, but it should be easy to find with search.

    I too thought that mesa-common-dev installs gl, but it looks like it doesn't: "link":http://www.qtcentre.org/threads/57256-SOLVED-error-cannot-find-lGL

    LE: Also you might want to remove QT += opengl from the .pro file, that links to the "Qt OpenGl":http://qt-project.org/doc/qt-5/qtopengl-index.html module, don't forget to run qmake after you modify the .pro file (also i think this might add the need for glut, if you don't explicitly use glut in your code remove the module and see if you need to install glut too, as far as i remember opengl is enough)



  • I installed
    @sudo apt-get install libgl1-mesa-dev@

    then I ran qmake, clean and rebuild.
    But I still get “cannot find -lGL”



  • for installing glut I followed these "instructions":http://kiwwito.com/installing-opengl-glut-libraries-in-ubuntu/
    particularly:
    @sudo apt-get install binutils-gold@

    Now I get this error

    @:-1: error: error: cannot open /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libGL.so: No such file or directory@

    and lots of undefined gl references ('glBlendFunc' etc...)
    I hope that's a step in the right direction..



  • I added

    @LIBS += -L/usr/lib/x86_64-linux-gnu/mesa -lGL@

    to the .pro file

    now I get

    @:-1: error: error: cannot open /usr/lib/x86_64-linux-gnu/mesa/libGL.so: No such file or directory@

    even though I've checked in the file browser and the file exists at specified location. Any ideas?



  • Try:
    sudo apt-get install libqt5opengl5-dev


Log in to reply