id summary reporter owner description type status milestone component version severity resolution keywords cc 9305 Errors when building Boost with MinGW Ben Key Andrey Semashev "When building the latest Boost SVN with MinGW I am getting the following errors. ./boost/detail/winapi/thread_pool.hpp: At global scope: ./boost/detail/winapi/thread_pool.hpp:30:9: error: '::RegisterWaitForSingleObjectEx' has not been declared using ::RegisterWaitForSingleObjectEx; ./boost/sync/detail/waitable_timer.hpp: In member function 'void boost::sync::detail::windows::waitable_timer_state::init()': ./boost/sync/detail/waitable_timer.hpp:169:26: error: 'OpenSemaphoreA' is not a member of 'boost::detail::winapi' tls_key_holder = boost::detail::winapi::OpenSemaphoreA The solution to the OpenSemaphoreA error is to simply add the following line to boost\detail\winapi\synchronization.hpp. using ::OpenSemaphoreA; I added it immediately after the ""using ::CreateSemaphoreA;"" line. The solution to the RegisterWaitForSingleObjectEx error is a little more complicated. There is a bug in the mingw-w64 version of winbase.h. It does not define RegisterWaitForSingleObjectEx. The solution is to replace the ""using ::RegisterWaitForSingleObjectEx;"" line with the following, #if defined(__MINGW32__) /* Work around a bug in the mingw-w64 version of winbase.h which does not define RegisterWaitForSingleObjectEx */ WINBASEAPI HANDLE WINAPI RegisterWaitForSingleObjectEx(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG); #else using ::RegisterWaitForSingleObjectEx; #endif The following patch resolves these issues and an issue with the bootstrap process I reported earlier, Index: boost/detail/winapi/synchronization.hpp =================================================================== --- boost/detail/winapi/synchronization.hpp (revision 86431) +++ boost/detail/winapi/synchronization.hpp (working copy) @@ -60,6 +60,7 @@ using ::CreateEventA; using ::OpenEventA; using ::CreateSemaphoreA; + using ::OpenSemaphoreA; # endif using ::ReleaseMutex; using ::ReleaseSemaphore; Index: boost/detail/winapi/thread_pool.hpp =================================================================== --- boost/detail/winapi/thread_pool.hpp (revision 86431) +++ boost/detail/winapi/thread_pool.hpp (working copy) @@ -27,7 +27,12 @@ typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_; using ::RegisterWaitForSingleObject; +#if defined(__MINGW32__) +/* Work around a bug in the mingw-w64 version of winbase.h which does not define RegisterWaitForSingleObjectEx */ +WINBASEAPI HANDLE WINAPI RegisterWaitForSingleObjectEx(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG); +#else using ::RegisterWaitForSingleObjectEx; +#endif using ::UnregisterWait; using ::UnregisterWaitEx; Index: tools/build/v2/engine/builtins.c =================================================================== --- tools/build/v2/engine/builtins.c (revision 86431) +++ tools/build/v2/engine/builtins.c (working copy) @@ -31,6 +31,7 @@ #ifdef OS_NT #include +#include #endif #if defined(USE_EXECUNIX) " Bugs closed Boost 1.55.0 winapi Boost Development Trunk Problem obsolete