您的位置 首页 Ubuntu

qt – 错误:QApplication:没有这样的文件或目录 – Ubuntu 12.04 LTS

Ubuntu 12.04 LTS

Qt版本:

$qmake -v
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu

.pro文件:

TEMPLATE += app
QT += core gui declarative
SOURCES += qtCppIntegration.cpp

.cpp文件:

#include <QApplication>
#include <QQuickView>
#include <QUrl>

int main (int argc,char *argv[])
{
  QApplication app(argc,argv);
  QQuickView view;
  view.setSource(QUrl("/home/...plesQtQuickQML/anchors.qml"));
  view.show();
  return app.exec();
}

错误:

$make
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtDeclarative -I/usr/include/qt4 -I. -o qtCppIntegration.o qtCppIntegration.cpp
qtCppIntegration.cpp:1:24: fatal error: QApplication: No such file or directory
compilation terminated.
make: *** [qtCppIntegration.o] Error 1

这样就可以了:

sudo apt-get install libqt4-dev

关于作者: dawei

【声明】:金华站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

热门文章