Error switching mfc to mixed mode

T

Tim Hitchcock

I have an existing MFC program consisting of an EXE and one DLL that I am
trying to convert into a mixed mode program. I am using Visual Studio.NET
2003 Professional and I am compiling in the IDE. I set the "Use Managed
Extensions" option to Yes in Configuration Properties General, added the
#using <mscorlib.dll> line to the StdAfx.h and attempted to compile. I
received the following error:

/RTC1 and /clr command-line options are incompatible

The documentation on the /clr Use Managed Extensions switch states that
selecting the /clr option will turn off /RTC automatically and the
Configuration Properties/C C++/Command Line window shows that it has been
removed, but I still get the above error. In Configuration Properties/C
C++/Code Generation, Smaller Type Check is set to "No" and Basic Runtime
Checks is set to "Default". Basic Runtime Checks doesn't seem to have a
disabled or off option with the closest being what it is set to or "Inherit
from project defaults" which when selected reselects "Default". How can I
get rid of this error message?
 
A

Anthony

I had this same problem when trying to compile a third party MFC dll using /clr. After a few hours of frantic clicking around and much cursing, I finally figured out that the project itself was not using Run-Time Checks, but each file had that option set individually. In other words, turning Run-Time Checks off for the project does not necessarily turn them off for each file.

Right click a code file in Solution Explorer and select the Properties. Then go to "Code Generation" under the C\C++ node and check the "Basic Runtime Checks" property. I'm betting it will indicate that Run-Time Checks are on for at least one of the files.

Hope that helps.
 
S

Severian

I had this same problem when trying to compile a third party MFC dll using
/clr. After a few hours of frantic clicking around and much cursing, I
finally figured out that the project itself was not using Run-Time Checks,
but each file had that option set individually. In other words, turning
Run-Time Checks off for the project does not necessarily turn them off for
each file.

Right click a code file in Solution Explorer and select the Properties.
Then go to "Code Generation" under the C\C++ node and check the "Basic
Runtime Checks" property. I'm betting it will indicate that Run-Time
Checks are on for at least one of the files.

Similarly, I've found it's often worthwhile to completely rebuild
large projects ("Solutions") some time after upgrading VS. Sometimes
the conversion makes some really strange things mutate in the build.

Last time I did it (on a solution with about 20 projects, and
thousands of files), it took a couple of days. But afterwards I found
working with VS7.1 (NET2003) much more intuitive (considering all its
idiosyncracies), and I also found mistakes I had made in the
configuration for VS6.

I also found lots of dead files that could be deleted and removed from
source control, which made the whole thing seem a bit more organized.

Software development is the only place I regularly retain any
semblance of organization.
 
T

Tim Hitchcock

Thank you. That solved the problem with the /RTC error messages.

Some time ago, we upgraded from Visual Studio 6 to Visual Studio.NET 2003.
It appears that all .cpp files included in the original Visual Studio 6
projects came over with the /RTC1 flag set. We have a huge number of these
files. Do you know of any way to automate the resetting of this flag on
..Cpp files to "default"?
 
H

hherry

Hi,

I've noticed that the settings of each code file is stored in the
parent project settings file "YourProject.vcproj" in standard XML
format.

"Basic Runtime Checks" property appears like this in the .vcproj file
:

<VisualStudioProject>
<Files>
<Filter Name="Source Files" ...>
<File RelativePath="YourCode1.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top