Solved

Converting unmanaged VC++ code into managed code

Posted on 2004-08-06
1
362 Views
Last Modified: 2013-12-03
Can someone explain how a  project written in unmanaged VC++ ts converted into managed VC++.NET code? I am following the instructions given in the following link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmex/html/vcconAddingMCToExistingApplication.asp

Unlike what the link instructs, however, clicking on the target project’s Property Pages->General->C/C++ does not offer an option Compile As Managed. The only way to get to an option Compile As Managed, so that Assembly Support (/clr) can be chosen, is when one clicks on the individual .cpp files.

It turned out, however, that even finding that was not enough to compile correctly the individual .cpp file. One needs also to change the Debug Information Format and the Code Generation->Basic Runtime Checks.

After all the above was done on the individual .cpp files, the files compiled correctly. However, it turned out that if one closes the project and opens it again the changed parameters in the said .cpp files are not retained. The project continues to be unmanaged despite the changes that one has made during the first opening the project.

What should be done to really convert an unmanaged code into a managed one?
0
Comment
Question by:judico
1 Comment
 
LVL 19

Accepted Solution

by:
drichards earned 500 total points
ID: 11769161
A lot depends on the settings in use before you try to convert to /clr compilation.  In general, all you need to do is change the "Use Managed Extensions" property in "Configuration Properties->General" in the project properties dialog.  Setting this to "Yes" will automatically change some other settings (like set "Compile As Managed" to "Assembly Support (/clr)" for the cpp files).  You also need to say "#using <mscorlib.dll>" in your cpp file to actually use managed objects.

This link provides somewhat more complete information, though it is just the doc for the /clr compiler switch:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefEECOMCompilation.asp

It explains all the things you can't use once you throw the /clr switch.

Once you save the project files 'File->Save All", the setting should persist across project loads.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
zeroMAx challenge 20 111
how to use an excel formula to remove accent marks from characters, like ñ é ü í ó 7 769
Problem to App 4 97
Using Specialized Fonts in CSS 1 23
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question