Important: Please read the Qt Code of Conduct -

[SOLVED]failing to compile my first qt app

  • hello guys i'm a complete newbie i barely installed qt5 armed with " C++ GUI Programming with QT 4 (2nd edition) i tried my first app but i can't make it compile here's the output
    18:56:31: Running steps for project test...
    18:56:31: Configuration unchanged, skipping qmake step.
    18:56:31: Starting: "/usr/bin/make"
    /opt/Qt5.2.0/5.2.0/gcc/bin/qmake -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug -o Makefile ../test/
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/Qt5.2.0/5.2.0/gcc/mkspecs/linux-g++ -I../test -I/opt/Qt5.2.0/5.2.0/gcc/include -I/opt/Qt5.2.0/5.2.0/gcc/include/QtWidgets -I/opt/Qt5.2.0/5.2.0/gcc/include/QtGui -I/opt/Qt5.2.0/5.2.0/gcc/include/QtCore -I. -I. -o main.o ../test/main.cpp
    g++ -Wl,-rpath,/opt/Qt5.2.0/5.2.0/gcc -Wl,-rpath,/opt/Qt5.2.0/5.2.0/gcc/lib -o test main.o -L/opt/Qt5.2.0/5.2.0/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
    /usr/bin/ld: cannot find -lGL
    collect2: error: ld returned 1 exit status
    make: *** [test] Error 1
    18:56:34: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project test (kit: Desktop Qt 5.2.0 GCC 32bit)
    When executing step 'Make'
    18:56:34: Elapsed time: 00:02.
    here's the code :
    SOURCES +=
    and the main.cpp code :
    #include <QApplication>
    #include <QLabel>
    int main(int argc,char *argv[]){
    QApplication app(argc,argv);
    QLabel * label = new QLabel("hello world");
    return app.exec();
    dunno if it matter ,i'm using ubuntu saucy 13.10, x86 if somebody can help with this and thx.

  • Hi, I had the same problem last year (and I got help from this forum). Probably you're lacking some bits, type in following in Terminal:

    @sudo apt-get install g++ libglu1-mesa-dev@

  • thx dude apparently opengl was missing now it works fine)

Log in to reply