简体   繁体   English

在VS2008中使用Qt时,IntelliSense无法正常工作

[英]When using Qt in VS2008, IntelliSense does not work properly

I use Qt 4.4.2 in Visual Studio 2008.我在 Visual Studio 2008 中使用 Qt 4.4.2。

When I am writing code, IntelliSense seems to die - it does not show any methods or data members in Qt objects such as QPushButton, does not see the QObject::connect static method, etc.当我编写代码时,IntelliSense 似乎死了——它没有显示 Qt 对象(如 QPushButton)中的任何方法或数据成员,没有看到 QObject::connect static 方法等。

Is it a typical situation or did I do something wrong while installing the library?这是典型情况还是我在安装库时做错了什么?

Most likely non-standard extensions like public slots: etc.最有可能的非标准扩展,如public slots:等。

There's already a FAQ at the Qt site: Intellisense does not work for my Qt application. Qt 站点上已经有一个常见问题解答: Intellisense 不适用于我的 Qt 应用程序。 What's wrong? 怎么了?

You need to tell Intellisense about the QT include directories.您需要告诉 Intellisense QT 包含目录。 This can be found by going to Tools -> Options -> Projects and Solutions -> VC++ Directories.这可以通过转到工具 -> 选项 -> 项目和解决方案 -> VC++ 目录来找到。 Add them to the Show Directories for: Include Files list on the right.将它们添加到右侧的Show Directories for: Include Files列表中。 I don't know if the QT installation does this by default or not.我不知道 QT 安装是否默认执行此操作。

Also, make sure that your VS Project files have the QT include directories as part of the Additional Include Directories under C/C++ General settings.此外,请确保您的 VS 项目文件具有 QT 包含目录,作为 C/C++ 常规设置下的附加包含目录的一部分。 (Although you probably have this already if you can successfully compile). (虽然如果你能成功编译,你可能已经有了这个)。

For me, the problem was solved by deleting the solution's.ncb file, then rebuilding to regenerate it.对我来说,问题是通过删除解决方案的 .ncb 文件,然后重建以重新生成它来解决的。 After that the intellisense worked.在那之后,智能感知起作用了。

Switch to VisualAssist.切换到 VisualAssist。 It is the must anyway.无论如何,这是必须的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM