Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++/CLI Errors in Intellisense, Compiles fine

...anyone an idea how to fix those?

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

The code is:

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

pConnectionStringBuilder is an instance of ConnectionStringBuilder.

The errors:

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

It compiles fine.

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.

like image 220
TomTom Avatar asked Dec 13 '22 04:12

TomTom


1 Answers

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

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

  1. Right-click the contents of the Error List window
  2. Uncheck "Show Intellisense Errors"
like image 124
Igor ostrovsky Avatar answered Feb 15 '23 22:02

Igor ostrovsky