1 #include <QApplication>
2 #include <QLabel>
3
4 int main(int argc,char **argv)
5 {
6 QApplication app(argc,argv);
7 QLabel label("helloQt");
8 label.show();
9 return app.exec();
10 }
$ qmake -project
$ qmake
$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/Qt5.0.2/5.0.2/gcc/mkspecs/linux-g++ -I. -I. -I/opt/Qt5.0.2/5.0.2/gcc/include -I/opt/Qt5.0.2/5.0.2/gcc/include/QtGui -I/opt/Qt5.0.2/5.0.2/gcc/include/QtCore -I. -o hellQt.o hellQt.cpp
hellQt.cpp:1:24: 致命错误:QApplication:没有那个文件或目录
编译中断。
make: *** [hellQt.o] 错误 1
这是什么问题,使用图形界面是可以编译的。看了下,图形界面生成的 Makefile和qmake生成的M阿kefile也不一样。这是为什么。这是我的环境变量
PATH=/opt/Qt5.0.2/Tools/QtCreator/bin/:$PATH
PATH=/opt/Qt5.0.2/5.0.2/gcc/bin/:$PATH
2 #include <QLabel>
3
4 int main(int argc,char **argv)
5 {
6 QApplication app(argc,argv);
7 QLabel label("helloQt");
8 label.show();
9 return app.exec();
10 }
$ qmake -project
$ qmake
$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/opt/Qt5.0.2/5.0.2/gcc/mkspecs/linux-g++ -I. -I. -I/opt/Qt5.0.2/5.0.2/gcc/include -I/opt/Qt5.0.2/5.0.2/gcc/include/QtGui -I/opt/Qt5.0.2/5.0.2/gcc/include/QtCore -I. -o hellQt.o hellQt.cpp
hellQt.cpp:1:24: 致命错误:QApplication:没有那个文件或目录
编译中断。
make: *** [hellQt.o] 错误 1
这是什么问题,使用图形界面是可以编译的。看了下,图形界面生成的 Makefile和qmake生成的M阿kefile也不一样。这是为什么。这是我的环境变量
PATH=/opt/Qt5.0.2/Tools/QtCreator/bin/:$PATH
PATH=/opt/Qt5.0.2/5.0.2/gcc/bin/:$PATH