Reputation: 395
I am getting error c2440 in my compiler but I cannot figure out what is causing it.
This is the error:
Error 2 error C2440: 'initializing' : cannot convert from 'int' to 'System::String ^' c:\users\***.****\documents\visual studio 2005\projects\cpas1\cpas1\Form1.h 1083
and this is the relevant code:
String *strFilename = 0;
Upvotes: 4
Views: 1145
Reputation: 16081
Managed types, when used in Managed C++, don't use stars (i.e. *), instead I believe they are called tracking handles (i.e. ^). As such your statement should be written like this:
String^ strFilename = nullptr;
Upvotes: 4
Reputation: 146910
System::String is a managed class. You must use nullptr
keyword, I believe, to initialize it.
Upvotes: 2