Boost C++ Libraries: Ticket #12974: Log and Asio without defined _WIN32_WINNT https://svn.boost.org/trac10/ticket/12974 <p> platform: Win10, VC14, boost 1.64 </p> <p> Using Log and Asio simultaneously cause link errors depending on order of includes. </p> <p> if _WIN32_WINNT not defined and there are several translation units, most of it use only Log and some use both Log and Asio I get link error </p> <p> if Log includes come first followed by Asio, building complete successfull<br /> for example </p> <pre class="wiki">#include &lt;boost/log/common.hpp&gt; #include &lt;boost/log/sources/severity_channel_logger.hpp&gt; #include &lt;boost/asio.hpp&gt; </pre><p> but if Asio include comes before Log includes<br /> for example </p> <pre class="wiki">#include &lt;boost/asio.hpp&gt; #include &lt;boost/log/common.hpp&gt; #include &lt;boost/log/sources/severity_channel_logger.hpp&gt; </pre><p> I get link error: LNK2038: mismatch detected for 'boost_log_abi': value 'v2s_mt_nt5' doesn't match value 'v2s_mt_nt6' in gtclient.obj </p> <p> this message generated by #pragma detect_mismatch in boost\log\detail\config.hpp : </p> <pre class="wiki">#if defined(BOOST_LOG_HAS_PRAGMA_DETECT_MISMATCH) #pragma detect_mismatch("boost_log_abi", BOOST_PP_STRINGIZE(BOOST_LOG_VERSION_NAMESPACE)) #endif </pre><p> it happend becase Log and Asio use different macros to define target Windows version.<br /> </p> <p> Log use BOOST_USE_WINAPI_VERSION<br /> but Asio use _WIN32_WINNT </p> <p> in \boost\asio\detail\config.hpp <br /> Asio checks if _WIN32_WINNT defined. if not, it defines it </p> <pre class="wiki"># define _WIN32_WINNT 0x0501 </pre><p> BOOST_USE_WINAPI_VERSION defined in boost\detail\winapi\config.hpp </p> <p> it depends on _WIN32_WINNT and _MSC_VER </p> <pre class="wiki">#if !defined(BOOST_USE_WINAPI_VERSION) #if defined(_WIN32_WINNT) #define BOOST_USE_WINAPI_VERSION _WIN32_WINNT #elif defined(WINVER) #define BOOST_USE_WINAPI_VERSION WINVER #else // By default use Windows Vista API on compilers that support it and XP on the others #if (defined(_MSC_VER) &amp;&amp; _MSC_VER &lt; 1500) || defined(BOOST_WINAPI_IS_MINGW) #define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WINXP #else #define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WIN6 #endif #endif #endif </pre><p> I think this error appeared in boost 1.60 when Log started using BOOST_USE_WINAPI_VERSION <a href="http://www.boost.org/users/history/version_1_60_0.html">http://www.boost.org/users/history/version_1_60_0.html</a> </p> <p> if I define _WIN32_WINNT=0x0A00 in compiler option, there are no link error with any includes ordering. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12974 Trac 1.4.3 anonymous Sun, 16 Apr 2017 14:06:01 GMT component changed; owner set https://svn.boost.org/trac10/ticket/12974#comment:1 https://svn.boost.org/trac10/ticket/12974#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Andrey Semashev</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">log</span> </li> </ul> Ticket Andrey Semashev Sun, 16 Apr 2017 15:19:29 GMT owner, component changed https://svn.boost.org/trac10/ticket/12974#comment:2 https://svn.boost.org/trac10/ticket/12974#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Andrey Semashev</span> to <span class="trac-author">chris_kohlhoff</span> </li> <li><strong>component</strong> <span class="trac-field-old">log</span> → <span class="trac-field-new">asio</span> </li> </ul> <p> I don't think this is going to be fixed unless Boost.ASIO is modified to either (a) use Boost.WinAPI or (b) default to the same target Windows version as Boost.WinAPI. My personal preference would be (a) for Boost.ASIO and any other Boost libraries, so I'm reassigning the ticket. </p> <p> As for the immediate problem solution, as you've already discovered, the solution is to manually configure the target Windows version. </p> Ticket