Greg Dolley’s Weblog

A Blog about Graphics Programming, Game Programming, Tips and Tricks

How to Fix Visual Studio Bug: "’/RTC1′ and ‘/clr’ Options are Incompatible"

Posted by gregd1024 on December 31, 2007

Have you ever received this error when converting a native C++ project to MC++?

1>cl : Command line error D8016 : ‘/RTC1’ and ‘/clr’ command-line options are incompatible

While, yes, it’s true that ‘/RTC1’ (basic runtime checking) with ‘/clr’ (.NET support) are incompatible options, the problem is there’s no place in the Visual Studio IDE to turn off ‘/RTC1’ once it’s set (not even from the command line editor). The Project Settings dialog just lists different modes of runtime checking without a “disable” option:

basic_runtime_checks_image

In order to fix this problem, follow these steps:

  • Open up your “vcproj” file in a regular text editor.
  • Search for all the strings that look like:

BasicRuntimeChecks=”3″

  • Replace all instances with this string:

BasicRuntimeChecks=”0″

In your project file the “BasicRuntimeChecks” variable may not necessarily equal “3.” It just happened to be the default in my project. Whatever number appears as your default just replace it with “0” and that should fix the problem.

-Greg Dolley

Subscribe via RSS here. Want email updates instead? Click here.

Advertisements

8 Responses to “How to Fix Visual Studio Bug: "’/RTC1′ and ‘/clr’ Options are Incompatible"”

  1. JP said

    I am trying to use (#using) System.dll…

    #using
    using namespace System;
    using namespace System::Text::RegularExpressions;

    I first got an “‘/RTC1′ and ‘/clr’ command-line options are incompatible” error.
    After setting BasicRuntimeChecks to “0” I get a new incompatibility error: “‘/Gm′ and ‘/clr’ command-line options are incompatible”

    I may not require RegExps but I want to do some simple string pattern validation.
    Maybe someone knows of an alternative?

  2. gregd1024 said

    Hi JP,

    The /Gm option simply enables minimal rebuilds. Why this is incompatible with /clr, I don’t know. But you can turn off /Gm in the “C/C++ -> Code Generation -> Enable Minimal Rebuild” option located in your project properties.

    Hope this helps.

    -Greg Dolley

  3. Michael said

    This is an inaccurate fix.
    In the project that i am experiency this command line error `Basic Runtime Checks` are set to default. The vcproj file indicates that [BasicRuntimeChecks=0].
    With this value set i still receive this error message…

    Regards,

    Michael

  4. gregd1024 said

    Michael,

    Hmmmm… that is weird. My fix worked with VS 2008 Express (original, not SP1). Maybe something has changed in SP1, or there’s some other setting conflicting causing your error. Obviously, the error is trying to tell us that /RTC1 can’t be used with /clr, but if you don’t have /RTC1 set, then I don’t know why VS would still show the same error. Maybe it’s a VS bug.

    If you figure out how to fix the error in your project, please post an update. Thanks. 🙂

    -Greg Dolley

  5. John said

    The above fix works for me on service pack 1. However, if like me you have a solution with multiple projects in it, you have to remember to edit each of the project files.

  6. mack said

    Command line error D8016 : ‘/EHs’ and ‘/clr’ command-line options are incompatible

    i am getting this error , now what to do ??

  7. PierreMF said

    Just to say thanks! 🙂
    I was wondering how to do that 🙂

  8. Nikhil said

    I have done according to above setting then i got new incompatibility error: “‘/Gm′ and ‘/clr’ command-line options are incompatible” then i have tried “C/C++ -> Code Generation -> Enable Minimal Rebuild” option located in your project properties but i got new error
    ‘/ZI’ and ‘/clr’ command-line options are incompatible pls help me….

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: