Boost C++ Libraries: Ticket #7260: Header order conflicts between Thread and ASIO https://svn.boost.org/trac10/ticket/7260 <p> This problem is still present as of 1.50. Link to discussion: <a class="ext-link" href="http://lists.boost.org/boost-users/2012/06/74823.php"><span class="icon">​</span>http://lists.boost.org/boost-users/2012/06/74823.php</a> </p> <p> Consider this following simple app: </p> <pre class="wiki">#include &lt;boost/thread/thread.hpp&gt; #include &lt;boost/asio.hpp&gt; #include &lt;boost/thread/recursive_mutex.hpp&gt; int main() { return 0; } </pre><p> </p> <p> If you try to build that on Windows, you receive the following error: </p> <pre class="wiki">In file included from c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/recursive_mutex.hpp:14:0, from c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/recursive_mutex.hpp:14, from build.cpp:3: c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/basic_recursive_mutex.hpp: In member function 'void boost::detail::basic_recursive_mutex_impl&lt;underlying_mutex_type&gt;::lock()': c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/basic_recursive_mutex.hpp:52:21: error: '_InterlockedExchange' is not a member of 'boost::detail' c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/basic_recursive_mutex.hpp: In member function 'void boost::detail::basic_recursive_mutex_impl&lt;underlying_mutex_type&gt;::unlock()': c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/basic_recursive_mutex.hpp:71:21: error: '_InterlockedExchange' is not a member of 'boost::detail' c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/basic_recursive_mutex.hpp: In member function 'bool boost::detail::basic_recursive_mutex_impl&lt;underlying_mutex_type&gt;::try_basic_lock(long int)': c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/basic_recursive_mutex.hpp:91:21: error: '_InterlockedExchange' is not a member of 'boost::detail' c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/basic_recursive_mutex.hpp: In member function 'bool boost::detail::basic_recursive_mutex_impl&lt;underlying_mutex_type&gt;::try_timed_lock(long int, const boost::system_time&amp;)': c:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/boost/thread/win32/basic_recursive_mutex.hpp:102:21: error: '_InterlockedExchange' is not a member of 'boost::detail' </pre><p> If asio.hpp is moved ahead of the thread headers, the error goes away. We’ve been trying to dictate #include order to work around this problem, but it keeps cropping up. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7260 Trac 1.4.3 viboes Tue, 18 Sep 2012 17:09:09 GMT description changed https://svn.boost.org/trac10/ticket/7260#comment:1 https://svn.boost.org/trac10/ticket/7260#comment:1 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/7260?action=diff&amp;version=1">diff</a>) </li> </ul> Ticket viboes Tue, 18 Sep 2012 17:20:52 GMT version, component changed; owner set https://svn.boost.org/trac10/ticket/7260#comment:2 https://svn.boost.org/trac10/ticket/7260#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">chris_kohlhoff</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.52.0</span> → <span class="trac-field-new">Boost 1.51.0</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">asio</span> </li> </ul> <p> I don't know if Boost.Asio should define WIN32_WINNT when WIN32_WINNT is defined but _WIN32_WINDOWS is undefined. </p> <pre class="wiki"># if !defined(_WIN32_WINNT) &amp;&amp; !defined(_WIN32_WINDOWS) # if defined(_MSC_VER) || defined(__BORLANDC__) # pragma message( \ "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\ "- add -D_WIN32_WINNT=0x0501 to the compiler command line; or\n"\ "- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.\n"\ "Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).") # else // defined(_MSC_VER) || defined(__BORLANDC__) # warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. # warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. # warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). # endif // defined(_MSC_VER) || defined(__BORLANDC__) # define _WIN32_WINNT 0x0501 # endif // !defined(_WIN32_WINNT) &amp;&amp; !defined(_WIN32_WINDOWS) </pre> Ticket