Click to See Complete Forum and Search --> : VC++ .Net


caffineplease
June 12th, 2002, 07:38 AM
Hi all.
I have a few questions regarding .Net :

1) If I have some code that was developed in VC++ ver 6 and I use Vis C++ ver 7 (.Net) to continue developing that code. Does that code automatically become managed code?

2) If code that was developed in Vis C++ 6 doesn't get translated when I open it up in VC .Net, how do I include managed code to be used within my old code? E.g. In my code, unmanaged.cpp, how do I do I use managed code? I tried


#include "MangedCode.h"

......

// Unmanaged code



and I get the following error message

fatal error C1190: managed targeted code requires '#using &ltmscorlib.dll&gt' and '/clr' option

This code is complaining that in ManagedCode.h I have the following line

#using &ltmscorlib.dll&gt

and without it in my managed code, it will give me alsorts of errors!

3) Do I have to compile my unmanaged code with /clr?

Regards

John

zerodefe
June 23rd, 2002, 10:47 AM
:eek: No offence, but to switch languages in the middle of a project is bad a software engineering practice. But, if you incist, I would go with Unmanaged C++, that way you can maintain most of your code, without modifications. Otherwise do a redisign and start over.

:cool: If you really want to change your code to managed C++. Add a "__gc" to the beginning of your class definition. Use "using namespace System;" for your namespace, and that should work.