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

Qt GUI example won't compile



  • I just installed Qt 5 and have never used Qt before. If I try to create a Qt GUI application, it will not compile the basic code that is already provided to me. Without altering the code at all, I received an error saying:

    @10:32:15: Running steps for project FirstGUI...
    10:32:15: Configuration unchanged, skipping qmake step.
    10:32:15: Starting: "/usr/bin/make"
    g++ -Wl,-rpath,/home/carl/CTC/QT5/5.0.2/gcc -Wl,-rpath,/home/carl/CTC/QT5/5.0.2/gcc/lib -o FirstGUI main.o mainwindow.o moc_mainwindow.o -L/home/carl/CTC/QT5/5.0.2/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
    /usr/bin/ld: cannot find -lGL
    collect2: ld returned 1 exit status
    make: *** [FirstGUI] Error 1
    10:32:15: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project FirstGUI (kit: Desktop Qt 5.0.2 GCC 32bit)
    When executing step 'Make'
    10:32:15: Elapsed time: 00:00.@

    The basic "Hello World" example for Qt Quick works fine, so I'm wondering if I need to reinstall, or install another library or what?


  • Moderators

    The error message is that libGL is not found. Have you installed it and its development package?



  • Awesome, thank you. I got it working by installing the libgl1-mesa-dev package on synaptic. I think I had some form of libGL but one without developer files. Sweeeet.


Log in to reply