我试图从qt.io编译一段示例c++代码:
#include <QApplication>
int main(int argc, char **argv){
QApplication app (argc, argv);
return app.exec();
}
然后我做了
qmake
。使用包含以下内容的qt.pro:TEMPLATE += app
QT += gui declarative
SOURCES += qt.cpp
当我执行
make
时,会出现以下错误:g++ -Wl,-O1 -o qt qt.o -L/usr/lib64/qt4 -lQtDeclarative -lQtGui -L/usr/lib64/qt4 -lQtCore -lpthread
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lQtDeclarative
collect2: error: ld returned 1 exit status
Makefile:102: recipe for target 'qt' failed
make: *** [qt] Error 1
我正在使用funtoo linux
最佳答案
在AMA的评论之后,我从qt.pro中删除了声明性语句。这解决了问题。
关于c++ - 无法使用QT编译C++,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41448670/