CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: VC++ .Net

  1. #1
    Join Date
    Jul 2000
    Location
    In a flat, Wimbledon, UK
    Posts
    251

    VC++ .Net

    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

    Code:
    #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

  2. #2
    Join Date
    Jun 2002
    Posts
    4
    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.

    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.
    Last edited by zerodefe; June 23rd, 2002 at 10:52 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured