QApplication file not found

如下的代码,开头的前三行代码都报错,并且报错信息一样:
QApplication file not found

#include<QApplication>
#include<QDialog>
#include<QLabel>
int main(int argc,char *argv[])
{
    QApplication a(argc,argv);
    QDialog w;
    QLabel label(&w);
    label.setText("Hello World!你好 Qt!");
    w.show();
    return a.exec();
}

解决办法:

头文件改成:

#include<QtWidgets/QApplication>
#include<QtWidgets/QDialog>
#include<QtWidgets/QLabel>

猜你喜欢

转载自my.oschina.net/u/1771419/blog/1799513