如何在我的 c++/cli 项目上启用智能感知?

发布于 2024-09-08 16:01:39 字数 268 浏览 11 评论 0原文

我正在使用 Visual Studio 2008,并且有一个加载托管 C++ DLL 的本机 C++ 项目,但在最后一个项目中,智能感知不再仅适用于托管代码。

这个项目(dll)有一个混合代码(本机和托管),如果我在干净的行上只写“::”,智能感知会给我从基类继承的方法,就像常规的一样,不适用于托管代码,对于例如

array <String^>^ ContactListToChat; 

我需要帮助,否则我将不得不盲目飞行。

I am using visual studio 2008 and I have a native c++ project that loads a managed c++ dll, but on the last one, the intellisense doesn't work anymore only for the managed code.

This project (dll) has a mixed code (native and managed) and if I write only "::" on a clean line, the intellisense gives me the methods inherits from the base class, like regular, not for the managed code, for example

array <String^>^ ContactListToChat; 

I need help, otherwise I´ll have to fly blind.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过期情话 2024-09-15 16:01:39

摘自解释智能感知历史的 msdn 博客:http://blogs.msdn.com/b/vcblog/archive/2008/02/29/intellisense-part-2-the-future.aspx

在 Visual Studio 2008 中,我们已经从快速且不太准确转变为有时快速且大部分准确...我们基本上是准确的,只是我们只捕获头文件的一次解析,即使它可能会根据不同的情况进行不同的解析。包含它的 .cpp(即不同的 #define、编译选项等)。

这是他对为什么智能感知有时表现出色而有时却完全盲目的解释。

您应该查看问题中提出的一些建议:如何让 IntelliSense 在 Visual Studio 2008 中可靠地工作

听起来最有帮助的是 Jogn Richardson 的回答。

1) 头文件路径设置不正确。当您发现智能感知无法正常工作的类型时,请使用 IDE 单击每个头文件以查找包含该类型的头文件。 (右键单击#include 并选择“打开文档...”)。如果在到达声明类型的文件之前失败,那么这就是您的问题。确保头文件搜索路径设置正确。

2) 智能感知数据库已损坏。这种情况经常发生。您需要关闭解决方案,删除 .ncb 文件,然后重新打开解决方案。我在这里发布了我用于此目的的宏来回答另一个问题。

Taken from an msdn blog explaining the history of intellisense: http://blogs.msdn.com/b/vcblog/archive/2008/02/29/intellisense-part-2-the-future.aspx

We have moved from fast and not very accurate to sometimes fast and mostly accurate in Visual Studio 2008... We are mostly accurate except that we only capture one parse of a header file even though it could be parsed differently depending on the .cpp that includes it (i.e. different #defines, compile options, etc).

This is his explanation as to why sometimes intellisense works brilliantly and why other times it is completely blind.

You should look at some of the suggestions posed in the question: How to get IntelliSense to reliably work in Visual Studio 2008

The one that sounds the most likely to help is Jogn Richardson's response.

1) Header file paths are not set-up correctly. When you find a type where intellisense is not working, use the IDE to click through each header file to find the one containing the type. (Right click on #include and select Open Document...). If this fails before you get to the file which declares the type then this is your problem. Make sure header file search paths are set-up correctly.

2) The intellisense database is corrupt. This happens ALL The time. You need to close the solution, delete the .ncb file, and then reopen the solution. I posted the macro I use for this in answer to another question here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文