Opened 10 years ago
Last modified 10 years ago
#7260 new Bugs
Header order conflicts between Thread and ASIO — at Version 1
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.51.0 | Severity: | Problem |
Keywords: | Cc: |
Description (last modified by )
This problem is still present as of 1.50. Link to discussion: http://lists.boost.org/boost-users/2012/06/74823.php
Consider this following simple app:
#include <boost/thread/thread.hpp> #include <boost/asio.hpp> #include <boost/thread/recursive_mutex.hpp> int main() { return 0; }
If you try to build that on Windows, you receive the following error:
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<underlying_mutex_type>::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<underlying_mutex_type>::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<underlying_mutex_type>::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<underlying_mutex_type>::try_timed_lock(long int, const boost::system_time&)': 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'
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.
Note:
See TracTickets
for help on using tickets.