C1083: Cannot open include file: 'QApplication' [SOLVED]
I created a very simple project using "Empty Qt project" from Qt Creator.
Then I added my files to the project.
Here is the .pro file
@CONFIG += qt
and here is the .h file
class MyPushButton : public QPushButton
MyPushButton(const QString &text);
and here is the .cpp file
MyPushButton::MyPushButton(const QString &text)
qDebug() << "My PushButton has been constructed";
and here is the main file
int main(int argc, char **argv)
QCoreApplication app(argc, argv);
MyPushButton helloButton("Hello world!"); helloButton.resize(100, 30); helloButton.show(); return app.exec();
when I run the project I get the errors
C1083: Cannot open include file: 'QApplication' No such file or directory
C1083: Cannot open include file: 'QPushButton' No such file or directory
I added this line to the .pro file
@ QT += widgets @
and rerun qmake and rebuild
When I run again I get no errors but the I get this
The program has unexpectedly finished.
and then nothing happens
So please HELP
You are instantiating a QCoreApplication. For a widget based application you should be using a QApplication.
And, for that to work properly, make sure you have this in your .pro file:
qt *= core gui widgets
Thank you everybody, It was like amccarthy said.