PDA

View Full Version : fatal error C1083: Cannot open include file: 'QApplication': No such file or director



Violet
1st November 2010, 15:48
Hi,

I have just started both with QT and Visual Studio :o. I wanted to build the following code:

#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->show();
return app.exec();
}


and I one got fatal error as:
fatal error C1083: Cannot open include file: 'QApplication': No such file or directory


what do you suggest me to do?

Thanks a lot in advance,
Violet

tbscope
1st November 2010, 15:52
Add the folder of the Qt include files to the paths that are used for finding headers.

Violet
1st November 2010, 16:20
Thanks a lot for your early response,

I am not sure if I got correctly but I copied the Qt include files to the path of the project but still have the error.
I looked for QApplication but couldn't find it, so maybe I have to add some libraries for QApplication?

Regards,
Violet

Zlatomir
1st November 2010, 16:33
Don't just copy headers, you will need to download the already built for Visual Studio Qt version (the one named Qt libraries 4.7.0 for Windows (VS 2008, 226 MB)), from here (http://qt.nokia.com/downloads) and the Visual Studio add-in (http://qt.nokia.com/downloads/visual-studio-add-in)(add-in doesn't work with express version of Visual Studio)
Or build Qt from source yourself.

But you can download the Qt SDK and use it, you have advantages with Visual Studio only if you already know the IDE. I think that you can separate the Visual Studio learning from Qt learning, and in the future "combine" them only if you really need them together.