Error: variable 'QApplication app' has initializer but incomplete type

自己在看【1】时,第一小节上面是用纯源码编写helloWorld,但是直接抄写它的代码:

#include <QtGui>
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    return app.exec();
}
就会产生下面的错误:

variable 'QApplication app' has initializer but incomplete type

但是用【2】中的填加:

#include <QApplication>
照样会出现下面的错误:

QApplication:No such file or directory

这个应该是因为我的Qt Creator 2.7.2 是基于Qt 5.1.0的,【3】上说QWidget 和QApplication从QtGui移到了QtWidgets。

但是改了之后还是出一堆错误,好蛋疼:

Error: variable 'QApplication app' has initializer but incomplete type_第1张图片


参考:

【1】Qt教程及软件(超级浅显易懂_非常适合初学者): http://ishare.iask.sina.com.cn/f/64428932.html

【2】关于错误: error: variable ‘QApplication app’ has initializer but incomplete type http://blog.csdn.net/code_think_write/article/details/7513645

【3】From Qt4 to Qt5, include files not found https://qt-project.org/forums/viewthread/23132

你可能感兴趣的:(Error: variable 'QApplication app' has initializer but incomplete type)