Boost C++ Libraries: Ticket #3090: Include file_lock.hpp in two compilation units results in multiple definitions at link time (win32) https://svn.boost.org/trac10/ticket/3090 <p> Including the file #include "boost/interprocess/sync/file_lock.hpp" from two seperate compilation units results in multiply defined symbols. </p> <p> The reason is that the following symbols contain nested class definitions. </p> <p> static inline bool unlink_file(const char *filename); static inline bool get_file_name_from_handle_function </p> <blockquote> <p> (void * hFile, wchar_t *pszFilename, std::size_t length, std::size_t &amp;out_length); </p> </blockquote> <p> Moving the definitions for the functions to a source file and compiling that into the library instead solves the issue. </p> <p> You can prove that the issue is the nested structs / classes by commenting out the function bodies. </p> <p> This is a pretty serious issue since it pretty much means you cannot use boost interprocess under windows right now. </p> <p> I'm compiling under MSVC8.1. The issue does not present itself under GCC, but then, these function implementations are win32 specific. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3090 Trac 1.4.3 jkp@… Tue, 26 May 2009 17:00:42 GMT attachment set https://svn.boost.org/trac10/ticket/3090 https://svn.boost.org/trac10/ticket/3090 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">testcase.txt</span> </li> </ul> <p> Small test-case to illustrate the issue: compile the code into a dll using VS2005 </p> Ticket jkp@… Tue, 26 May 2009 17:01:59 GMT <link>https://svn.boost.org/trac10/ticket/3090#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3090#comment:1</guid> <description> <p> I have confirmed that this bug is confined to VS2005: in VS2008 the problem goes away. This is obviously a serious issue because it means anyone on VS2005 cannot use the library right now. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Tue, 26 May 2009 22:12:54 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3090#comment:2 https://svn.boost.org/trac10/ticket/3090#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">duplicate</span> </li> </ul> <p> Duplicates <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2992" title="#2992: Bugs: Linker error using 1.39 with vc80 (closed: fixed)">#2992</a>. </p> Ticket