C ++ / CLI errors in Intellisense, compiles fine

... does anyone know how to fix them?

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

The code:

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

pConnectionStringBuilder is an instance of ConnectionStringBuilder.

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 just don't make sense at all;)

There are two other warnings, but it is clear that this is not a mistake:

1> Tradex.Connectivity.Rithmic.vcxproj → C: \ Work \ Tradex \ Source \ Debug \ Tradex.Connectivity.Rithmic.dll rithmicconnector.cpp (104): warning: C6001: use of uninitialized memory "oParams". rithmicconnector.cpp (108): warning: C6001: use of uninitialized memory "oLoginParams". 1> Code analysis completed - 0 errors, 0 warnings (s)

It compiles fine.

I tried using 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, by the way, is also incorrect and compiles;)

I really prefer not to have Intellisense errors.

+4
source share
3 answers

Intellisense for C ++ / CLI is often confused and reports false positives. This is just not as good as Intellisense for C #. In fairness, C ++ code as a whole is much more difficult to analyze incrementally than C # code (for example, if I add one pragma #define to the header file, the structure of any file that imports the header file can completely change).

As soon as I start to see false Intellisense errors, I usually just turn them off in the error list window:

  • Right-click the contents of the Error List window.
  • Uncheck "Show Intellisense Errors"
+11
source

If you always work with C ++ and worry about Intellisense errors, you may need to permanently disable this error reporting: Tools → Option → Text Editor → C / C ++ → Advanced → IntelliSence → Disable Error Reporting

+1
source

I found that if the file ends without a new line (for example, the last line of the include file is #endif and there is no CRLF after it), this will ruin Intellisense and cause it to erroneously indicate errors.

+1
source

Source: https://habr.com/ru/post/1401743/


All Articles