Groups | Blog | Home
all groups > visual c > april 2004 >

visual c : /RTC1 and /CLR options are incompatible



Arun Kannan
4/30/2004 4:21:02 AM
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 N
-Runtime Library -Mutlit Threaded Debug threade
-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

Carl Daniel [VC++ MVP]
4/30/2004 7:03:23 AM
[quoted text, click to view]

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

Daniel P.
4/30/2004 8:35:15 AM
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.



[quoted text, click to view]
Framework. I have opened the application in Visual Studio 2003. I changed
the compiler option to /clr. I have set following properties:
[quoted text, click to view]

Arun Kannan
5/3/2004 3:11:03 AM
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.

Tommy Vercetti
5/4/2004 11:03:14 AM
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.

[quoted text, click to view]
StuartV
5/19/2004 12:36:09 PM
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 incompatibl

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"

Carl Daniel [VC++ MVP]
5/19/2004 1:16:25 PM
[quoted text, click to view]

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

StuartV
5/19/2004 1:41:03 PM
Thanks. A Notepad Find and Replace in the .vcproj file took care of it

Replaced: BasicRuntimeChecks="3
AddThis Social Bookmark Button