I am trying to implement the ProtectedData Class in C++ but are having some issues with compilation. My first error comes from not being able to use #using <System.Security.dll>
. The error is that IntelliSense: "#using" requires C++/CLI to be enabled, however when I go into my project settings and set the common language runtime support to /clr, In my project I do not see my sytax errors getting corrected anymore. I then thought ok this must have fixed all the issues but then i go to compile and then I receive and error that '/clr' and '/Gm' command-line options are incompatible. So i go to look at this and I am not sure what to put to correct my problem. Is there any way I can use the ProtectedData Class without having to go through the different config process?
I am using Microsoft Visual C++ 2010 Express.
The link to the ProtectedData Class is here: http://msdn.microsoft.com/en-us/library/system.security.cryptography.protecteddata.aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-2
Thank you for your time.
You could use Microsoft Visual C# 2010 Express instead. C++/CLI is best used only as a .NET/native bridging framework, and only when other methods of interoperation aren't suitable (such P/Invoke).
If you decide to use C++, you do need to use the /CLR switch. Although you can tweak a C++ project into a C++/CLI project, it's best to start fresh with the one of the CLR project templates.
Two ways to indicate that you want to use an external .NET assembly:
#using
, orSince you mentioned Intellisense, you'll find that it's not supported in C++/CLI code.