Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
/RTC1 and /CLR options are incompatible
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.vc.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Arun Kannan
GOOD ANSWER
Hi:
We are planning to upgrade a MFC Application (.Exe) to compile on Dot Net Framework. I have opened the application in Visual Studio 2003. I changed the compiler option to /clr. I have set following properties:
-Basic Run Time checks to Default
-Smaller Type Check to No
-Runtime Library -Mutlit Threaded Debug threaded
-Use of MFC - use Standard windows libraries (tried with MFC as Static and Shared dll.. No luck)

Now, i am wondering whether we can directly convert any MFC application to compile with /clr. IF so, then are the changes required.

TIA.

Arun Kannan
Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Daniel P.
GOOD ANSWER
I did that and there was one major change required:
Since you cannot use /RTC1 you will not thave any run-time checking so
dynamic_cast will not works, instead use the classic C-style cast.

I edited the .vcproj file manually and set
RuntimeTypeInfo="FALSE"
everywhere.

"Arun Kannan" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

the compiler option to /clr. I have set following properties:
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Carl Daniel [VC++ MVP] (VIP)
GOOD ANSWER
Daniel P. wrote:
[Original message clipped]

This is false. /RTC has nothing to do with dynamic_cast at all. Rather
it's /GR (enable RTTI) that determines whether dynamic_cast works. Further,
when targeting .NET, all casts are automatically dynamic_casts unless the
compiler can prove that the cast will succeed, in which case they're
converted to a try_cast in MSIL.

-cd

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Arun Kannan
GOOD ANSWER
Hi:

I am still facing this issue.. I hd removed all run-time check option but it still includes the run-time check. Now my dout is whether it's possible to migrate a MFC application to .Net compliance. Please let me know your thoughts.

Thanks in Advance..

Arun
Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
chaz (VIP)
GOOD ANSWER
Carl,
Could you provide some docs on this new behavior of dynamic_cast regarding
"proving the cast will succeed" . This new behavior it seems is bypassing a
call to rtdynamicCast which some of our code expected and is now therefore
failing .

thanks

"Carl Daniel [VC++ MVP]" wrote:

[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Tommy Vercetti
GOOD ANSWER
I got the same error even though the RTC1 option wasn't enabled in my
command line. Very confusing. I gave up and recreated the project file
from scratch as a .NET/MFC project.

Arun Kannan wrote:
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (2 votes from other users already)
 
 
    
StuartV
GOOD ANSWER
I have a Windows that I originally developed in VC6. I have now gotten it to compile and work correctly in VS.Net 2003. So far, so good.

Now I want to have it use a managed extension, to call a Web Service. I went into my project properties and changed Use Managed Extensions to "Yes". I added "#using <mscorlib.dll>" to my stdafx.h file. Now when I try to compile the service for Debug, I get:

CWCSSvc Command line error D2016 : '/RTC1' and '/clr' command-line options are incompatible

The documentation says that setting Use Managed Extensions to Yes should disable any incompatible options. I have verified that Properties.C/C++.Code Generation.Basic Runtime Checks is set to "Default".

It kind of looks like the problem is that the existing source files have individual settings that include /RTC1 that are overriding the project-level settings, and those settings are causing this error. How can I fix this? Short of editing the settings for every individual source file, that is. I want all my source files to share the same settings. Having individual compile settings for each file will be an impossible maintenance task going forward.
Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
Carl Daniel [VC++ MVP] (VIP)
GOOD ANSWER
StuartV wrote:
[Original message clipped]

Edit the settings for every file individually. You can probably do this
quickly with a search-and-replace in the project file by opening it in a
text editor.

-cd

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
StuartV
GOOD ANSWER
Thanks. A Notepad Find and Replace in the .vcproj file took care of it.

Replaced: BasicRuntimeChecks="3"
With: BasicRuntimeChecks="0"
Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
 




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734