Qt应用程序未能编译

Qt应用程序未能编译,qt,ubuntu,compilation,qt5,Qt,Ubuntu,Compilation,Qt5,我刚刚安装了Qt5,并使用“使用QT4进行C++GUI编程(第二版)”,我试图编译一个非常有用的应用程序代码,如下所示: -test.pro: SOURCES += \ main.cpp QT+=widgets 和main.cpp: #include <QApplication> #include <QLabel> int main(int argc,char *argv[]){ QApplication app(argc,argv); QLab

我刚刚安装了Qt5,并使用“使用QT4进行C++GUI编程(第二版)”,我试图编译一个非常有用的应用程序代码,如下所示: -test.pro:

SOURCES += \
  main.cpp
QT+=widgets
和main.cpp:

#include <QApplication>
#include  <QLabel>

int main(int argc,char *argv[]){
    QApplication app(argc,argv);
    QLabel * label = new QLabel("hello world");
    label->show();
   return app.exec();
}

我正在使用ubuntu 13.10 x86。

在您的机器上安装OpenGL。它丢失了,您的make文件需要它来构建项目(“-lGL丢失”)。

有时,即使您已经安装了OpenGL,它也无法工作。然后尝试使用:
sudo apt get安装libgl1 mesa dev

19:45:21: Running steps for project test...
19:45:21: Configuration unchanged, skipping qmake step.
19:45:21: Starting: "/usr/bin/make" 
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
19:45:21: 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'
19:45:21: Elapsed time: 00:00.