Search code examples
stringc++-clisystemmarshallingcryptlib

System String to std string without marshal


Is there any way to convert System::String to std::string if I am not allowed to use msclr/marshal_cppstd.h?

The reason is that I need to use cryptlib.h in the same project and I get an error when I include both:

cryptlib.h and wincrypt.h can't both be used at the same time due to conflicting type names


Solution

  • The error is telling you the problem is cryplib.h and wincrypt.h cannot be #included into the same source file. I think the text of the message comes from whatever comes after the #error, which is down to the user - see here.
    So, if you can't included them into the same source file, you could partition up your code differently and include them in different source files. Marshalling the string is not what the error message is complaining about.