Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

Error switching mfc to mixed mode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim Hitchcock - 15 Mar 2005 04:53 GMT
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?
Anthony - 15 Mar 2005 18:33 GMT
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.
Severian - 15 Mar 2005 20:54 GMT
>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
[quoted text clipped - 7 lines]
>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.

--
Sev
Tim Hitchcock - 15 Mar 2005 21:27 GMT
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"?

>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
[quoted text clipped - 12 lines]
> ---
> Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/ 
hherry - 24 Mar 2005 14:36 GMT
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
                       .
                       .
                       BasicRuntimeChecks="3"
                       .
                       . />
               </FileConfiguration>
           </File>
           <File RelativePath="YourCode2.cpp">
               <FileConfiguration
Name="Debug|Win32">
                   <Tool
                       .
                       .
                       BasicRuntimeChecks="3"
                       .
                       . />
               </FileConfiguration>
           </File>
           .
           .
           .
       </Filter>
   </Files>
</VisualStudioProject>
The values are :
"0" : Default
"1" : /RTCs
"2" : /RTCu
"3" : /RTC1

The better thing to do is to delete the line {BasicRuntimeChecks="3"}
as the code will inherit from project defaults.

You may be able to make a script to do this automatically.
Hope it will help you.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.