id summary reporter owner description type status milestone component version severity resolution keywords cc 7910 MSVC-11 can't find some symbols in Boost::System static library Gene Panov Beman Dawes " {{{ #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: // > b2 --with-system threading=multi link=static runtime-link=shared clean // > 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) && _MSC_VER >= 1700 #include // looks like implementations of three error categories are defined in MSVC 11 include files in 'std' namespace #include // 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& 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& system_category() { return reinterpret_cast(std::system_category()); } error_category const& generic_category() { return reinterpret_cast(std::generic_category()); } error_category const& iostream_category() { return reinterpret_cast(std::iostream_category()); } }} #endif // defined(_MSC_VER) && _MSC_VER >= 1700 #endif // BOOST_SYSTEM_ERROR_CATEGORY_DIRTY_WORKAROUND }}} " Bugs new To Be Determined system Boost 1.52.0 Showstopper undefined symbol boost system generic_category system_category bdawes@…