Boost C++ Libraries: Ticket #6695: config/auto_link.hpp #errors unnecessarily errors when mixing /RTC and release CRTs https://svn.boost.org/trac10/ticket/6695 <p> config/auto_link.hpp has the following code: #if defined(<span class="underline">MSVC_RUNTIME_CHECKS) &amp;&amp; !defined(_DEBUG) # pragma message("Using the /RTC option without specifying a debug runtime will lead to linker errors") # pragma message("Hint: go to the code generation options and switch to one of the debugging runtimes") # error "Incompatible build options" #endif </span></p> <p> This prevents builds that would otherwise succeed. The attached program uses the program_options and system libraries. If I remove these checks, I can build, link, and run it with the following invocations of Visual Studio 2003's cl.exe and link.exe, with no warnings or errors: </p> <p> cl.exe /c /Foauto_link_test.obj /W3 /GR /GX /Od /MD /RTC1 /DDEBUG /I&lt;boost include path&gt; auto_link_test.cpp link.exe /subsystem:console /LIBPATH:&lt;boost lib path&gt; /OUT:auto_link_test.exe auto_link_test.obj </p> <p> When the flags are present, I hit the previously mentioned #error. </p> <p> In my company's local version of boost 1.46.1, I have removed this check with no issues. We build the boost libraries and our code with Visual Studio 2003 (i386), Visual Studio 2005 (i386 and x64), Visual Studio 2008 (i386 and x64) and Visual Studio 2010 (i386 and x64). </p> <p> My proposed fix is to remove these checks entirely. If there are specific libraries that genuinely won't work with /RTC and a debug runtime, then this check could be moved to those library headers. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6695 Trac 1.4.3 Ben Craig <ben.craig@…> Fri, 16 Mar 2012 18:42:46 GMT attachment set https://svn.boost.org/trac10/ticket/6695 https://svn.boost.org/trac10/ticket/6695 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">auto_link_test.cpp</span> </li> </ul> Ticket John Maddock Sun, 08 Jul 2012 18:21:17 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6695#comment:1 https://svn.boost.org/trac10/ticket/6695#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> None the less, you're not supposed to mix /RTC with release builds, MSDN says: </p> <p> <em>"If you compile your program at the command line using any of the /RTC compiler options, any pragma optimize instructions in your code will silently fail. This is because run-time error checks are not valid in a release (optimized) build. </em></p> <p> <em>"You should use /RTC for development builds; /RTC should not be used for a retail build. /RTC cannot be used with compiler optimizations (/O Options (Optimize Code)). A program image built with /RTC will be slightly larger and slightly slower than an image built with /Od (up to 5 percent slower than an /Od build)."</em> </p> <p> I don't doubt that some libraries and programs link OK using this combination, but I've also seen linker errors because the release runtimes don't contain all the debugging functions that /RTC code may call - sorry don't recall the details right now. </p> <p> So my inclination is to continue to disallow this, and let folks that really want to try this to do so at their own risk by modifying the source locally. </p> Ticket Dulantha Fernando Mon, 27 Jul 2015 22:21:57 GMT <link>https://svn.boost.org/trac10/ticket/6695#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6695#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/6695#comment:1" title="Comment 1">johnmaddock</a>: </p> <blockquote class="citation"> <p> None the less, you're not supposed to mix /RTC with release builds, MSDN says: </p> </blockquote> <p> But then why is the /RTC1 option included as a command line argument when I build boost in release mode? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 10 Aug 2015 11:56:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6695#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6695#comment:3</guid> <description> <blockquote class="citation"> <p> But then why is the /RTC1 option included as a command line argument when I build boost in release mode? </p> </blockquote> <p> That's news to me, and I'm unable to reproduce here. How are you building Boost? </p> </description> <category>Ticket</category> </item> </channel> </rss>