/RTC1 and /CLR options are incompatible

G

Guest

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

Arun Kannan
 
D

Daniel P.

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 said:
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.
 
C

Carl Daniel [VC++ MVP]

Daniel said:
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.

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
 
G

Guest

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
 
T

Tommy Vercetti

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.
 
G

Guest

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"

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.
 
C

Carl Daniel [VC++ MVP]

StuartV said:
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.

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
 
G

Guest

Thanks. A Notepad Find and Replace in the .vcproj file took care of it

Replaced: BasicRuntimeChecks="3
With: BasicRuntimeChecks="0"
 

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