Boost C++ Libraries: Ticket #7910: MSVC-11 can't find some symbols in Boost::System static library https://svn.boost.org/trac10/ticket/7910 <pre class="wiki">#ifndef BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND #define BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND // I have not had a chance to investigate the root cause of this problem, // but it happens when I use boost::asio on MSVC-11 (Visual Studio 2012). // The problem seems to be that boost::system defines generic_error_category and system_error_category, // but then somehow doesn't have these symbols in the libboost_system-vc110-mt-1_52.lib library when you build boost // with just "/b2" with and toolset=msvc-11.0 // For me the problem happened when I was trying to use boost::asio from something I compiled with MSVC-11.0. // I got linker errors, so it's a showstopper. // Feel free to contact me at MyName.MyLastName@Gmail.com for more detail. // Now, I found that if you build boost on your machine with /b2 and then specifically do these two steps: // &gt; b2 --with-system threading=multi link=static runtime-link=shared clean // &gt; b2 --with-system threading=multi link=static runtime-link=shared // then magicaly the problem goes away and you don't need this workaround below it seems. // But since the root cause is not clear to me, the problem may not go away for you after the steps above. // So, if it didn't go away for you indeed, feel free to add this piece of source code into your application. // Two ways to do it: // 1. if you are adding this piece of code as an include file, uncomment these two lines: // #undef BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND // #define BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND inline // 2. but if you are adding it as a separate compilation unit (source file), then don't uncomment anything #if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1700 #include &lt;system_error&gt; // looks like implementations of three error categories are defined in MSVC 11 include files in 'std' namespace #include &lt;boost/system/error_code.hpp&gt; // interfaces for those error categories required by boost in 'boost' namespace, but somehow implementations cannot be found in the library files // glue that hooks up the implementations from MSVC11 to the interfaces required by boost // (this glue code is **unsafe** in case MSVC or Boost change interfaces for these error categories, because reinterpret_cast is used, // so a safer way to go about it would be to wrap std::error_category&amp; as a field of some wrapper class that inherits from boost::system::error_category, // but it works with these versions, because boost and std interfaces are the same ("binary compatible"!) now and I don't yet have time to do it properly) namespace boost { namespace system { error_category const&amp; system_category() { return reinterpret_cast&lt;const error_category&amp;&gt;(std::system_category()); } error_category const&amp; generic_category() { return reinterpret_cast&lt;const error_category&amp;&gt;(std::generic_category()); } error_category const&amp; iostream_category() { return reinterpret_cast&lt;const error_category&amp;&gt;(std::iostream_category()); } }} #endif // defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1700 #endif // BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7910 Trac 1.4.3 Gene Panov Sun, 20 Jan 2013 23:21:51 GMT <link>https://svn.boost.org/trac10/ticket/7910#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7910#comment:1</guid> <description> <p> Actually the code should be this: </p> <pre class="wiki">namespace boost { namespace system { BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND error_category const&amp; system_category() { return reinterpret_cast&lt;const error_category&amp;&gt;(std::system_category()); } BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND error_category const&amp; generic_category() { return reinterpret_cast&lt;const error_category&amp;&gt;(std::generic_category()); } BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND error_category const&amp; iostream_category() { return reinterpret_cast&lt;const error_category&amp;&gt;(std::iostream_category()); } }} </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 09 Jun 2013 19:23:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7910#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7910#comment:2</guid> <description> <p> Please could you check if <a class="changeset" href="https://svn.boost.org/trac10/changeset/81808" title="System/FileSystem/Asio/Thread: ref #7278 Added noexcept to ...">[81808]</a> fixes the issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 07 Jul 2013 16:32:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7910#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7910#comment:3</guid> <description> <p> PING !!! </p> </description> <category>Ticket</category> </item> </channel> </rss>