Boost C++ Libraries: Ticket #1862: file_lock.hpp will not compile - at least under MSVC8 https://svn.boost.org/trac10/ticket/1862 <p> Hi, </p> <p> I'm attempting to use interprocess::file_lock in 1.35.0. Unfortunately, it will not compile at all in my environment, which is Microsoft Visual Studio 2005 on WinXP. Merely #include'ing boost/interprocess/sync/file_lock.hpp causes this failure mode. </p> <p> A summary of the errors: </p> <pre class="wiki">&lt;...&gt; boost/interprocess/sync/file_lock.hpp(167) : error C2535: 'bool boost::interprocess::file_lock::timed_acquire_file_lock(boost::interprocess::file_handle_t,bool &amp;,const boost::posix_time::ptime &amp;)' : member function already defined or declared e:\dev\cub\boost\boost/interprocess/sync/file_lock.hpp(110) : see declaration of 'boost::interprocess::file_lock::timed_acquire_file_lock' &lt;...&gt; boost/interprocess/sync/file_lock.hpp(195) : error C2535: 'bool boost::interprocess::file_lock::timed_acquire_file_lock_sharable(boost::interprocess::file_handle_t,bool &amp;,const boost::posix_time::ptime &amp;)' : member function already defined or declared e:\dev\cub\boost\boost/interprocess/sync/file_lock.hpp(138) : see declaration of 'boost::interprocess::file_lock::timed_acquire_file_lock_sharable' &lt;...&gt; boost/interprocess/sync/file_lock.hpp(119) : error C3861: 'try_acquire_file_lock': identifier not found &lt;...&gt; boost/interprocess/sync/file_lock.hpp(147) : error C3861: 'try_acquire_file_lock_sharable': identifier not found &lt;...&gt; boost/interprocess/sync/file_lock.hpp(175) : error C3861: 'try_acquire_file_lock': identifier not found &lt;...&gt; boost/interprocess/sync/file_lock.hpp(188) : error C3861: 'sleep': identifier not found &lt;...&gt; boost/interprocess/sync/file_lock.hpp(203) : error C3861: 'try_acquire_file_lock_sharable': identifier not found &lt;...&gt; boost/interprocess/sync/file_lock.hpp(262) : error C2039: 'timed_acquire_file_lock' : is not a member of 'boost::interprocess::detail' &lt;...&gt; boost/interprocess/sync/file_lock.hpp(298) : error C2039: 'timed_acquire_file_lock_sharable' : is not a member of 'boost::interprocess::detail' </pre><p> Investigation of file_lock.hpp reveals that: </p> <ul><li>Indeed, both timed_acquire_file_lock and timed_acquire_file_lock_sharable are defined twice <em>in their entirety</em> </li><li>Various functions calls are to functions in incorrect namespaces; <ul><li>try_acquire_file_lock, for example, is I believe in boost::interprocess::detail, which is not in scope (only boost::detail is). </li><li>I'm not sure what scope sleep is supposed to be in.. there are a few implementations peppered throughout Boost </li></ul></li></ul><p> I'm not sure if other compilers perhaps have different scoping semantics and/or different ways of handling function redefinitions, but this definitely doesn't seem to fly on MSVC8. </p> <p> A simple reproduction case: </p> <pre class="wiki">#include &lt;boost/interprocess/sync/file_lock.hpp&gt; int main(int argc, char** argv) { printf("hello world"); return 0; } </pre><p> Really only the inclusion of the header file is necessary, as stated earlier. </p> <p> Thanks! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1862 Trac 1.4.3 Ranger Harke <rharke.bugs@…> Fri, 25 Apr 2008 15:24:00 GMT <link>https://svn.boost.org/trac10/ticket/1862#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1862#comment:1</guid> <description> <p> I also note that, of the duplicated functions, the first set uses winapi::sched_yield() to relinquish its timeslice, whereas the second set uses sleep(0) to do the same. </p> <p> I'm not sure which is meant to be correct, as winapi::sched_yield() looks non-portable, while sleep() is a function that is not in scope. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Fri, 02 May 2008 11:09:32 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1862#comment:2 https://svn.boost.org/trac10/ticket/1862#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">fixed</span> </li> </ul> <p> Fixed in revision 45019 </p> Ticket Mon, 03 Nov 2008 14:20:34 GMT milestone deleted https://svn.boost.org/trac10/ticket/1862#comment:3 https://svn.boost.org/trac10/ticket/1862#comment:3 <ul> <li><strong>milestone</strong> <span class="trac-field-deleted">Boost 1.35.1</span> </li> </ul> <p> Milestone Boost 1.35.1 deleted </p> Ticket