Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 - Cannot open source file <QtGui/QApplication>

I'm under Visual Studio 2010 and have installed qt-vs-addin-1.1.11-opensource.exe and qt-win-opensource-4.8.4-vs2010.exe. There is Qt in my VS menu. When I tried to start Qt4 project->Qt Application and error seemed to occur.

Here is the default code generated automatically:

#include "sp_qt.h"
#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    SP_Qt w;
    w.show();
    return a.exec();
}

Error: Cannot open include file QtGui/QApplication

It seems VS cannot find the header.I know this should be simple, I have tried to modify environment variables PATH and QTDIR but doesn't seem to work(I added C:\Qt\4.8.4\bin to PATH and C:\Qt to QTDIR).

like image 567
CDT Avatar asked Jan 21 '26 18:01

CDT


1 Answers

You need to make sure the path to the QT header files are in the project settings. Open up the project settings and go into "Configuration Properties-> C/C++ -> General" and add the path in "Additional Include Directories.

You can access the project properties by either right clicking on the project and selecting "Properties" or selecting the "Project" menu and selecting "Properties".

like image 133
Captain Obvlious Avatar answered Jan 23 '26 07:01

Captain Obvlious