Boost C++ Libraries: Ticket #8027: thread library fails to compile with Visual Studio 2003 https://svn.boost.org/trac10/ticket/8027 <p> The thread library fails to build with VS2003. I've tried both boost-1.53.0 and the trunk from SVN. Prior to this, I had successfully compiled boost-1.49.0, so it's something that changed after that. I know the compiler is ancient, but sadly I can't use a newer one. </p> <p> I'm building it with the command: bjam toolset=msvc-7.1 variant=release thread </p> <p> An example error log: </p> <p> compile-c-c++ bin.v2\libs\thread\build\msvc-7.1\release\debug-store-database\debug-symbols-on\link-static\pch-off\threading-multi\win32\thread.obj thread.cpp boost\thread\future.hpp(354) : warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used boost\thread\future.hpp(1394) : error C2951: template declarations are only permitted at global or namespace scope </p> <blockquote> <p> boost\thread\future.hpp(1469) : see reference to class template instantiation 'boost::unique_future&lt;R&gt;' being compiled </p> </blockquote> <p> boost\thread\future.hpp(1400) : error C2955: 'boost::unique_future' : use of class template requires template argument list </p> <blockquote> <p> boost\thread\future.hpp(1469) : see declaration of 'boost::unique_future' </p> </blockquote> <p> boost\thread\future.hpp(1400) : error C2146: syntax error : missing ')' before identifier 'a_future' boost\thread\future.hpp(1400) : error C2146: syntax error : missing ';' before identifier 'a_future' boost\thread\future.hpp(1400) : error C2377: 'boost::unique_future&lt;R&gt;::future_ptr' : redefinition; typedef cannot be overloaded with any other symbol </p> <blockquote> <p> boost\thread\future.hpp(1375) : see declaration of 'boost::unique_future&lt;R&gt;::future_ptr' </p> </blockquote> <p> boost\thread\future.hpp(1400) : error C2059: syntax error : ')' boost\thread\future.hpp(1401) : error C2065: 'a_future' : undeclared identifier boost\thread\future.hpp(1402) : fatal error C1903: unable to recover from previous error(s); stopping compilation </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8027 Trac 1.4.3 viboes Tue, 12 Feb 2013 06:37:34 GMT owner, status changed https://svn.boost.org/trac10/ticket/8027#comment:1 https://svn.boost.org/trac10/ticket/8027#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> It seems that the compiler doesn't like </p> <pre class="wiki"> template &lt;class Rp, class Fp&gt; friend BOOST_THREAD_FUTURE&lt;Rp&gt; detail::make_future_async_object(BOOST_THREAD_FWD_REF(Fp) f); template &lt;class Rp, class Fp&gt; friend BOOST_THREAD_FUTURE&lt;Rp&gt; detail::make_future_deferred_object(BOOST_THREAD_FWD_REF(Fp) f); </pre><p> I have no way to check it. Please could you try commenting these lines and make public all the needed members? </p> Ticket James Perry <jperry@…> Tue, 12 Feb 2013 06:53:19 GMT <link>https://svn.boost.org/trac10/ticket/8027#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8027#comment:2</guid> <description> <p> If I comment out those lines, it successfully compiles! </p> <p> Thanks </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 12 Feb 2013 07:06:13 GMT</pubDate> <title>status changed; resolution set; milestone deleted https://svn.boost.org/trac10/ticket/8027#comment:3 https://svn.boost.org/trac10/ticket/8027#comment:3 <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">wontfix</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">To Be Determined</span> </li> </ul> <p> Gald to see that this work for you. I will no make any change on the repository. </p> Ticket Manfred <kuhnkies@…> Wed, 06 Mar 2013 12:15:43 GMT <link>https://svn.boost.org/trac10/ticket/8027#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8027#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8027#comment:3" title="Comment 3">viboes</a>: </p> <blockquote class="citation"> <p> Gald to see that this work for you. I will no make any change on the repository. </p> </blockquote> <p> Hello, </p> <p> I'm not sure whether I understood the meaning of this posting, regarding changes for the next release of boost. I really would appreciate the code being fixed for MSVC .NET 2003 in the next release of boost. Thanks to this ticket here we were able to reproduce the fix and to build boost thread on MSVC2003 at all. I.e. we have a conditional compilation flag around the lines L1390-L1396 above. </p> <p> before L1390: (file boost/thread/future.hpp, release 1_53_0) </p> <blockquote> <p> <code>#if (!defined _MSC_VER || _MSC_VER &gt;= 1400) // _MSC_VER == 1400 on MSVC 2005</code> </p> </blockquote> <p> after L1396: </p> <blockquote> <p> <code>#endif // #if (!defined _MSC_VER || _MSC_VER &gt;= 1400)</code> </p> </blockquote> <p> This should activate the code for compilers that don't define _MSC_VER (i.e. non-Microsoft compilers) and also for Microsoft compilers from MSVC 2005 and newer; MSVC 2003 then disregards the lines it does not understand syntactically. With this modification, thread.lib was built successfully on MSVC 2003, 2008, 2010, 2012, MinGW GCC 4.7.2 on x86 and x64. I didn't test MSVC 2005 (don't have it any longer) and I was too lazy to test with a MinGW GCC 4.8.0 preview. I don't know if there are any side effects if that functions are not declared as friends (MSVC 2003 only), but until now there didn't occur any problems in our application. </p> <p> Best regards </p> <blockquote> <p> Manfred </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 20 Mar 2013 22:26:19 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/8027#comment:5 https://svn.boost.org/trac10/ticket/8027#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">wontfix</span> </li> </ul> Ticket viboes Wed, 20 Mar 2013 22:31:04 GMT <link>https://svn.boost.org/trac10/ticket/8027#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8027#comment:6</guid> <description> <p> I will fix it soon. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 23 Mar 2013 01:28:29 GMT</pubDate> <title>milestone set https://svn.boost.org/trac10/ticket/8027#comment:7 https://svn.boost.org/trac10/ticket/8027#comment:7 <ul> <li><strong>milestone</strong> → <span class="trac-field-new">Boost 1.54.0</span> </li> </ul> <p> Committed in trunk <a class="changeset" href="https://svn.boost.org/trac10/changeset/83521" title="Thread: Added constexpr to future default constructor; protect code ...">[83521]</a>. </p> Ticket viboes Sun, 31 Mar 2013 10:56:54 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8027#comment:8 https://svn.boost.org/trac10/ticket/8027#comment:8 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</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/83660" title="Thread: merge from trunk 1.54. Fix #8027,#8323,#8337.">[83660]</a>) Thread: merge from trunk 1.54. Fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8027" title="#8027: Bugs: thread library fails to compile with Visual Studio 2003 (closed: fixed)">#8027</a>,<a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8323" title="#8323: Bugs: boost::thread::try_join_for/try_join_until may block indefinitely due ... (closed: fixed)">#8323</a>,<a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8337" title="#8337: Bugs: The internal representation of &#34;std::string(this-&gt;code()-&gt;message())&#34; ... (closed: fixed)">#8337</a>. </p> Ticket