Boost C++ Libraries: Ticket #4217: On Mingw-w64-i386 windows 7 plus gcc 4.5.0 gcc version 4.5.0 20100303 (experimental) (GCC) compiling error. https://svn.boost.org/trac10/ticket/4217 <p> ./boost/thread/win32/thread_primitives.hpp:123:73: warning: declaration of 'void boost::detail::win32::Sleep(long unsigned int)' with C language linka ge ./boost/smart_ptr/detail/yield_k.hpp:58:29: warning: conflicts with previous declaration 'void boost::detail::Sleep(unsigned int)' In file included from ./boost/thread/once.hpp:14:0, </p> <blockquote> <p> from libs\thread\src\win32\thread.cpp:17: </p> </blockquote> <p> ./boost/thread/win32/once.hpp: In destructor 'boost::once_flag::~once_flag()': ./boost/thread/win32/once.hpp:47:35: error: '_InterlockedExchange' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp: In function 'void* boost::detail::allocate_event_handle(void*&amp;)': ./boost/thread/win32/once.hpp:65:32: error: '_InterlockedCompareExchange' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp: In function 'void boost::call_once(boost::once_flag&amp;, Function)': ./boost/thread/win32/once.hpp:92:20: error: '_InterlockedCompareExchange' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp:108:25: error: '_InterlockedIncrement' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp:111:21: error: '_InterlockedExchange' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp:128:25: error: '_InterlockedIncrement' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp:130:21: error: '_InterlockedExchange' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp:145:17: error: '_InterlockedIncrement' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp:164:17: error: '_InterlockedExchangeAdd' is not a member of 'boost::detail' ./boost/thread/win32/once.hpp:172:21: error: '_InterlockedExchange' is not a member of 'boost::detail' libs\thread\src\win32\thread.cpp: In static member function 'static unsigned int boost::thread::hardware_concurrency()': libs\thread\src\win32\thread.cpp:307:28: warning: missing braces around initializer for '_SYSTEM_INFO::&lt;anonymous union&gt;' libs\thread\src\win32\thread.cpp: In function 'LARGE_INTEGER boost::this_thread::&lt;unnamed&gt;::get_due_time(const boost::detail::timeout&amp;)': libs\thread\src\win32\thread.cpp:330:42: warning: missing braces around initializer for '_LARGE_INTEGER::&lt;anonymous struct&gt;' </p> <blockquote> <p> "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -mthreads -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_LIB=1 -I"." -c -o "bin.v2\libs\thread\b </p> </blockquote> <p> uild\gcc-mingw-4.5.0\debug\link-static\threading-multi\win32\thread.o" "libs\thread\src\win32\thread.cpp" </p> <p> ...failed gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.5.0\debug\link-static\threading-multi\win32\thread.o... gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.5.0\debug\link-static\threading-multi\win32\tss_dll.o gcc.compile.c++ bin.v2\libs\thread\build\gcc-mingw-4.5.0\debug\link-static\threading-multi\win32\tss_pe.o ...skipped &lt;pbin.v2\libs\thread\build\gcc-mingw-4.5.0\debug\link-static\threading-multi&gt;libboost_thread-mgw45-mt-d-1_43.a(clean) for lack of &lt;pbin.v2\ libs\thread\build\gcc-mingw-4.5.0\debug\link-static\threading-multi&gt;win32\thread.o... ...skipped &lt;pbin.v2\libs\thread\build\gcc-mingw-4.5.0\debug\link-static\threading-multi&gt;libboost_thread-mgw45-mt-d-1_43.a for lack of &lt;pbin.v2\libs\th read\build\gcc-mingw-4.5.0\debug\link-static\threading-multi&gt;win32\thread.o... ...skipped &lt;pstage\lib&gt;libboost_thread-mgw45-mt-d-1_43.a for lack of &lt;pbin.v2\libs\thread\build\gcc-mingw-4.5.0\debug\link-static\threading-multi&gt;libb oost_thread-mgw45-mt-d-1_43.a... common.mkdir bin.v2\libs\wave common.mkdir bin.v2\libs\wave\build </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4217 Trac 1.4.3 Steven Watanabe Sat, 15 May 2010 02:19:51 GMT owner, component changed https://svn.boost.org/trac10/ticket/4217#comment:1 https://svn.boost.org/trac10/ticket/4217#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Vladimir Prus</span> to <span class="trac-author">Anthony Williams</span> </li> <li><strong>component</strong> <span class="trac-field-old">build</span> → <span class="trac-field-new">thread</span> </li> </ul> Ticket feiyunw@… Mon, 24 May 2010 13:54:43 GMT cc set https://svn.boost.org/trac10/ticket/4217#comment:2 https://svn.boost.org/trac10/ticket/4217#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">feiyunw@…</span> added </li> </ul> <p> I got compile-time warnings with ogre-1.7.1 and boost-1.43.0 thread: </p> <pre class="wiki">[ 0%] Building CXX object OgreMain/CMakeFiles/OgreMain.dir/src/OgreAlignedAllocator.cpp.obj cd OgreMain &amp;&amp; C:\MinGW\bin\g++.exe -DOgreMain_EXPORTS -D_WIN32_WINNT=0x0500 -DBOOST_ALL_NO_LIB -DOGRE_NONCLIENT_BUILD -DFREEIMAGE_LIB -D_MT -D_USRDLL -O3 -DNDEBUG -ID:\prj\ogre\ogre-1.7\OgreMain\include -I..\include -ID:\prj\ogre\ogre-1.7\Dependencies\include -ID:\prj\ogre\ogre-1.7\Dependencies\include\OIS -ID:\prj\ogre\ogre-1.7\Dependencies\include\Cg -IC:\PROGRA~1\MI21AE~1\Include -IC:\boost\include\boost-1_43 -ID:\prj\ogre\ogre-1.7\OgreMain\include\WIN32 -ID:\prj\ogre\ogre-1.7\OgreMain\src\nedmalloc -msse -o CMakeFiles\OgreMain.dir\src\OgreAlignedAllocator.cpp.obj -c D:\prj\ogre\ogre-1.7\OgreMain\src\OgreAlignedAllocator.cpp In file included from C:\boost\include\boost-1_43/boost/thread/win32/thread_heap_alloc.hpp:8:0, from C:\boost\include\boost-1_43/boost/thread/detail/thread_heap_alloc.hpp:15, from C:\boost\include\boost-1_43/boost/thread/tss.hpp:10, from D:\prj\ogre\ogre-1.7\OgreMain\include/Threading/OgreThreadHeadersBoost.h:29, from D:\prj\ogre\ogre-1.7\OgreMain\include/Threading/OgreThreadHeaders.h:30, from D:\prj\ogre\ogre-1.7\OgreMain\include/OgreStdHeaders.h:110, from D:\prj\ogre\ogre-1.7\OgreMain\include/OgrePrerequisites.h:315, from D:\prj\ogre\ogre-1.7\OgreMain\src\OgreAlignedAllocator.cpp:30: C:\boost\include\boost-1_43/boost/thread/win32/thread_primitives.hpp:123:73: warning: declaration of 'void boost::detail::win32::Sleep(long unsigned int)' with C language linkage C:\boost\include\boost-1_43/boost/smart_ptr/detail/yield_k.hpp:58:29: warning: conflicts with previous declaration 'void boost::detail::Sleep(unsigned int)' </pre><p> My environment is Windows XP (Chinese version, 32bit)/MinGW/g++-4.5.0. The reason is that Sleep() parameter type mismatches. In boost/thread/win32/thread_primitives.hpp: </p> <pre class="wiki">namespace boost { namespace detail { namespace win32 { ... extern "C" { ... __declspec(dllimport) void __stdcall Sleep(unsigned long); </pre><p> while in boost/smart_ptr/detail/yield_k.hpp: </p> <pre class="wiki">namespace boost { namespace detail { #if !defined( BOOST_USE_WINDOWS_H ) extern "C" void __stdcall Sleep( unsigned ms ); #endif </pre><p> It looks like "extern C" modifier will make the function ignore namespace declaration. This makes sense as the function is defined in another module where we can't export namespace constraints. We should correct the parameter type to stop the compiler warnings. </p> Ticket Peter Dimov Wed, 26 May 2010 13:59:15 GMT owner, status, component changed https://svn.boost.org/trac10/ticket/4217#comment:3 https://svn.boost.org/trac10/ticket/4217#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">Peter Dimov</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>component</strong> <span class="trac-field-old">thread</span> → <span class="trac-field-new">smart_ptr</span> </li> </ul> <p> 'unsigned long' is correct according to &lt;wtypes.h&gt;, reassigning to myself. </p> Ticket Peter Dimov Wed, 26 May 2010 17:49:39 GMT <link>https://svn.boost.org/trac10/ticket/4217#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4217#comment:4</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/62246" title="DWORD is unsigned long, not unsigned int. Refs #4217.">[62246]</a>) DWORD is unsigned long, not unsigned int. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4217" title="#4217: Bugs: On Mingw-w64-i386 windows 7 plus gcc 4.5.0 gcc version 4.5.0 20100303 ... (closed: fixed)">#4217</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Sat, 10 Jul 2010 21:07:16 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4217#comment:5 https://svn.boost.org/trac10/ticket/4217#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/63826" title="Merge [62246] to release. Fixes #4217.">[63826]</a>) Merge <a class="changeset" href="https://svn.boost.org/trac10/changeset/62246" title="DWORD is unsigned long, not unsigned int. Refs #4217.">[62246]</a> to release. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4217" title="#4217: Bugs: On Mingw-w64-i386 windows 7 plus gcc 4.5.0 gcc version 4.5.0 20100303 ... (closed: fixed)">#4217</a>. </p> Ticket Hesh Mon, 11 Jun 2012 09:00:57 GMT <link>https://svn.boost.org/trac10/ticket/4217#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4217#comment:6</guid> <description> <p> Hello, </p> <p> I am using Ubuntu, codeBlocks, , boost 1.46 in GCC 4.7 [ yield_k.hpp ] I get this error ' error : Sleep was not declared in this scope' tried #include &lt;unistd.h&gt; and Sleep to sleep, nothing worked. when I change it to sleep 'error:expected initializer before 'sleep<em> how Do I resolve this issue ?? </em></p> </description> <category>Ticket</category> </item> </channel> </rss>