Intellisense 中的 C++/CLI 错误,编译正常 [英] C++/CLI Errors in Intellisense, Compiles fine

查看:23
本文介绍了Intellisense 中的 C++/CLI 错误,编译正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

...有人知道如何解决这些问题吗?

...anyone an idea how to fix those?

Visual Studio 2011 Beta,试图为此准备一些框架,现在正在处理有限的问题列表.

Visual Studio 2011 Beta, trying to get some frameworks prepared for that and now going through a limited list of issues.

代码是:

String^ pUser = (System::String^) pConnectionStringBuilder["UserName"];
String^ pPass = (System::String^) pConnectionStringBuilder["Password"];
String^ pBroker = (System::String^) pConnectionStringBuilder["Broker"];

pConnectionStringBuilder 是 ConnectionStringBuilder 的一个实例.

pConnectionStringBuilder is an instance of ConnectionStringBuilder.

错误:

2   IntelliSense: expression must have pointer-to-object or handle-to-CLI-array type    c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  62  39  Tradex.Connectivity.Rithmic
3   IntelliSense: expression must have integral or unscoped enum type   c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  62  64  Tradex.Connectivity.Rithmic
4   IntelliSense: expression must have pointer-to-object or handle-to-CLI-array type    c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  63  39  Tradex.Connectivity.Rithmic
5   IntelliSense: expression must have integral or unscoped enum type   c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  63  64  Tradex.Connectivity.Rithmic
6   IntelliSense: expression must have pointer-to-object or handle-to-CLI-array type    c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  64  41  Tradex.Connectivity.Rithmic
7   IntelliSense: expression must have integral or unscoped enum type   c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  64  66  Tradex.Connectivity.Rithmic
8   IntelliSense: expression must have pointer-to-object or handle-to-CLI-array type    c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  269 6   Tradex.Connectivity.Rithmic
9   IntelliSense: expression must have integral or unscoped enum type   c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  269 32  Tradex.Connectivity.Rithmic

他们根本没有任何意义;)

and they simply make NO sense at all ;)

还有另外两个警告,但很明显这不是错误:

There are two other warnings, but quite obviously that is not an error:

1> Tradex.Connectivity.Rithmic.vcxproj -> C:\Work\Tradex\Source\Debug\Tradex.Connectivity.Rithmic.dllrithmicconnector.cpp(104):警告:C6001:使用未初始化的内存oParams".rithmicconnector.cpp(108):警告:C6001:使用未初始化的内存oLoginParams".1> 代码分析完成 -- 0 个错误,0 个警告

1> Tradex.Connectivity.Rithmic.vcxproj -> C:\Work\Tradex\Source\Debug\Tradex.Connectivity.Rithmic.dll rithmicconnector.cpp(104): warning : C6001: Using uninitialized memory 'oParams'. rithmicconnector.cpp(108): warning : C6001: Using uninitialized memory 'oLoginParams'. 1> Code Analysis Complete -- 0 error(s), 0 warning(s)

它编译得很好.

我尝试使用 pConnectionStringBuilder->default - 猜猜是什么;) 抱怨.

I tried to use pConnectionStringBuilder->default - guess what ;) Complains.

2   IntelliSense: class "System::Data::Common::DbConnectionStringBuilder" has no member "default"   c:\Work\Tradex\Source\Tradex.Connectivity.Rithmic\RithmicConnector.cpp  62  65  Tradex.Connectivity.Rithmic

顺便说一句也是错误的,它编译;)

which incidentally also is wrong and it compiles ;)

我真的不想出现智能感知错误.

I really prefer not to have Intellisense errors.

推荐答案

Intellisense for C++/CLI 经常会混淆并报告误报错误.对于 C#,它根本不如 Intellisense.公平地说,C++ 代码一般比 C# 代码更难增量分析(例如,如果我将单个 #define pragma 添加到头文件中,任何导入头文件的文件的结构都可能完全).

Intellisense for C++/CLI will often get confused and report false-positive errors. It is simply not as good as Intellisense for C#. To be fair, C++ code in general is much harder to analyze incrementally than C# code (e.g., if I add a single #define pragma into a header file, the structure of any file that imports the header file may change completely).

一旦我开始看到虚假的 Intellisense 错误,我通常只是在错误列表窗口中将它们关闭:

Once I start seeing spurious Intellisense errors, I usually just turn them off in the Error List window:

  1. 右键单击错误列表"窗口的内容
  2. 取消选中显示智能感知错误"

这篇关于Intellisense 中的 C++/CLI 错误,编译正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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