0

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

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Szaby
  • 39
  • 3
  • Which names are conflicting? – doctorlove Jul 29 '13 at 14:53
  • CL : warning : Both cryptlib.h and wincrypt.h have been included into the same source file. These contain conflicting type names that prevent both from being used simultaneously. To allow compilation to proceed you need to avoid including wincrypt.h in your code. c:\documents and settings\...\cryptlib.h(58): fatal error C1189: #error : "cryptlib.h and wincrypt.h can't both be used at the same time due to conflicting type names" ... this is the entire error – Szaby Jul 29 '13 at 15:13

1 Answers1

0

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.

doctorlove
  • 18,872
  • 2
  • 46
  • 62
  • Thank you, I included the cryptlib.h in the header and the msclr/marshal_cppstd.h in the source file and it's working. – Szaby Jul 30 '13 at 08:45