Visual Studio 2010 - 无法打开源文件 <QtGui/QApplication> [英] Visual Studio 2010 - Cannot open source file <QtGui/QApplication>

查看:82
本文介绍了Visual Studio 2010 - 无法打开源文件 <QtGui/QApplication>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2010 下安装了 qt-vs-addin-1.1.11-opensource.exeqt-win-opensource-4.8.4-vs2010.exe.我的 VS 菜单中有 Qt.当我尝试启动 Qt4 project->Qt Application 时,似乎发生了错误.

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();
}

错误:无法打开包含文件 QtGui/QApplication

似乎 VS 找不到标题.我知道这应该很简单,我尝试修改环境变量 PATHQTDIR 但似乎不起作用(我添加了 C:\Qt\4.8.4\binPATHC:\QtQTDIR).

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).

推荐答案

您需要确保 QT 头文件的路径在项目设置中.打开项目设置并进入配置属性-> C/C++ -> 常规"并在附加包含目录"中添加路径.

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".

这篇关于Visual Studio 2010 - 无法打开源文件 &lt;QtGui/QApplication&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆