Click to See Complete Forum and Search --> : /clr


caffineplease
June 10th, 2002, 09:18 AM
Does anyone know how I can set this option in .NET as I'm trying to compile unmanaged code and its not allowing me since I have to set the /CLR option.

Does anyone know?

regards

John

JohnCz
June 10th, 2002, 04:05 PM
Did you try "/clr (Common Language Runtime Compilation)" from MSDN (Compiler Options Listed Alphabetically)?

drrobg
June 13th, 2002, 03:53 AM
From the solutions explorer right click on the project which you want to add the /clr option to and select properties. Under the c++ folder in the properties dialog select command line.
In the additional options box type "/clr".

You may have to change a couple of the other compile options as some of the defaults are not compatible with the /clr option.

caffineplease
June 13th, 2002, 04:00 AM
Thanks for your reply. another question. If I port my old VC++ code over to .Net with that option does my unmanaged code become mangaed?

Can I use the .Net environment in the same way that I use VC++ 6 without fear that it's going to change my code?

Regards

John

drrobg
June 14th, 2002, 04:27 AM
When you port your project your existing classes do not become managed. To make existing classes managed you have to use the __gc keyword in the class header file, for example:

__gc class MyClass
{
public MyClass();
etc...
}

As far as using VC7, I am sure that your code will not be changed but you may need to change it. I had to give up porting a large MFC app as there were so many compile error regarding Message maps, strings and fstreams. However, i write all my new stuff using VC7 and find it very good.

Good luck