Boost C++ Libraries: Ticket #9305: Errors when building Boost with MinGW https://svn.boost.org/trac10/ticket/9305 <p> When building the latest Boost SVN with MinGW I am getting the following errors. </p> <p> ./boost/detail/winapi/thread_pool.hpp: At global scope: ./boost/detail/winapi/thread_pool.hpp:30:9: error: '::<a class="missing wiki">RegisterWaitForSingleObjectEx</a>' has not been declared </p> <blockquote> <p> using ::<a class="missing wiki">RegisterWaitForSingleObjectEx</a>; </p> </blockquote> <p> ./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' </p> <blockquote> <p> tls_key_holder = boost::detail::winapi::OpenSemaphoreA </p> </blockquote> <p> The solution to the OpenSemaphoreA error is to simply add the following line to boost\detail\winapi\synchronization.hpp. </p> <blockquote> <p> using ::OpenSemaphoreA; </p> </blockquote> <p> I added it immediately after the "using ::CreateSemaphoreA;" line. </p> <p> The solution to the <a class="missing wiki">RegisterWaitForSingleObjectEx</a> error is a little more complicated. There is a bug in the mingw-w64 version of winbase.h. It does not define <a class="missing wiki">RegisterWaitForSingleObjectEx</a>. The solution is to replace the "using ::<a class="missing wiki">RegisterWaitForSingleObjectEx</a>;" line with the following, </p> <p> #if defined(<span class="underline">MINGW32</span>) /* Work around a bug in the mingw-w64 version of winbase.h which does not define <a class="missing wiki">RegisterWaitForSingleObjectEx</a> */ WINBASEAPI HANDLE WINAPI <a class="missing wiki">RegisterWaitForSingleObjectEx</a>(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG); #else using ::<a class="missing wiki">RegisterWaitForSingleObjectEx</a>; #endif </p> <p> The following patch resolves these issues and an issue with the bootstrap process I reported earlier, </p> <p> Index: boost/detail/winapi/synchronization.hpp =================================================================== --- boost/detail/winapi/synchronization.hpp (revision 86431) +++ boost/detail/winapi/synchronization.hpp (working copy) @@ -60,6 +60,7 @@ </p> <blockquote> <p> using ::CreateEventA; using ::OpenEventA; using ::CreateSemaphoreA; </p> </blockquote> <p> + using ::OpenSemaphoreA; </p> <blockquote> <p> # endif </p> <blockquote> <p> using ::<a class="missing wiki">ReleaseMutex</a>; using ::<a class="missing wiki">ReleaseSemaphore</a>; </p> </blockquote> </blockquote> <p> 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 @@ </p> <blockquote> <p> typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_; </p> </blockquote> <blockquote> <p> using ::<a class="missing wiki">RegisterWaitForSingleObject</a>; </p> </blockquote> <p> +#if defined(<span class="underline">MINGW32</span>) +/* Work around a bug in the mingw-w64 version of winbase.h which does not define <a class="missing wiki">RegisterWaitForSingleObjectEx</a> */ +WINBASEAPI HANDLE WINAPI <a class="missing wiki">RegisterWaitForSingleObjectEx</a>(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG); +#else </p> <blockquote> <p> using ::<a class="missing wiki">RegisterWaitForSingleObjectEx</a>; </p> </blockquote> <p> +#endif </p> <blockquote> <p> using ::<a class="missing wiki">UnregisterWait</a>; using ::<a class="missing wiki">UnregisterWaitEx</a>; </p> </blockquote> <p> 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 @@ </p> <blockquote> <p> #ifdef OS_NT #include &lt;windows.h&gt; </p> </blockquote> <p> +#include &lt;winioctl.h&gt; </p> <blockquote> <p> #endif </p> </blockquote> <blockquote> <p> #if defined(USE_EXECUNIX) </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9305 Trac 1.4.3 Kohei Takahashi Fri, 18 Nov 2016 10:20:08 GMT component changed; owner set https://svn.boost.org/trac10/ticket/9305#comment:1 https://svn.boost.org/trac10/ticket/9305#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">Building Boost</span> → <span class="trac-field-new">winapi</span> </li> </ul> Ticket Andrey Semashev Fri, 18 Nov 2016 10:43:17 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/9305#comment:2 https://svn.boost.org/trac10/ticket/9305#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">obsolete</span> </li> </ul> <p> Please, try the latest version from git and create a new ticket if the problem still exists. </p> Ticket