Boost C++ Libraries: Ticket #3501: Reusing concepts from different compile units yields multiple defined symbols https://svn.boost.org/trac10/ticket/3501 <p> Currently I use the ublas concepts defined in ublas/detail/concepts.hpp to derive concepts based on ublas concepts such as </p> <p> template&lt;class X&gt; struct Vector : boost::numeric::ublas::<a class="missing wiki">VectorConcept</a>&lt;X&gt; {}; </p> <p> In my unit test project I have different compile units that use BOOST_CONCEPT_ASSERT to assure Vector concept compliance. This yields multiple defined symbols for the following methods (and full specialized versions): </p> <p> ublas/detail/concepts.hpp: void concept_checks(); template&lt;class T&gt; <a class="missing wiki">ZeroElement</a>(T); template&lt;class T&gt; <a class="missing wiki">OneElement</a>(T); </p> <p> inlining those solves the problem (for me). I'm compiling on MSVC9.0. Current trunk seems to have this methods still not-inlined. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3501 Trac 1.4.3 Gunter Sun, 04 Oct 2009 19:27:36 GMT <link>https://svn.boost.org/trac10/ticket/3501#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3501#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/56578" title="see #3501: Reusing concepts from different compile units yields ...">[56578]</a>) see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3501" title="#3501: Bugs: Reusing concepts from different compile units yields multiple defined ... (closed: fixed)">#3501</a>: Reusing concepts from different compile units yields multiple defined symbols </p> <ul><li>added BOOST_UBLAS_INLINE macros to requested locations </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Sun, 04 Oct 2009 19:44:20 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/3501#comment:2 https://svn.boost.org/trac10/ticket/3501#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> @Christoph: please check if the committed version fixes your problem. If not, please provide a small example to reproduce the problem. </p> Ticket anonymous Mon, 05 Oct 2009 05:48:24 GMT <link>https://svn.boost.org/trac10/ticket/3501#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3501#comment:3</guid> <description> <p> @Gunter Committed version fixes my problem. I did not test on a fresh trunk checkout. All I did was replacing concepts.hpp of 1.39.0 by current head revision. Thanks for your help. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Mon, 05 Oct 2009 22:48:31 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3501#comment:4 https://svn.boost.org/trac10/ticket/3501#comment:4 <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/56614" title="fix #3499 and fix #3501: * added inline to free helper functions * ...">[56614]</a>) fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3499" title="#3499: Bugs: VectorConcept missing DefaultConstructible concept check (closed: fixed)">#3499</a> and fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3501" title="#3501: Bugs: Reusing concepts from different compile units yields multiple defined ... (closed: fixed)">#3501</a>: </p> <ul><li>added inline to free helper functions </li><li>added missing concept check </li><li>fixed broken internal checks </li></ul> Ticket christoph.heindl@… Fri, 09 Oct 2009 08:20:37 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/3501#comment:5 https://svn.boost.org/trac10/ticket/3501#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">fixed</span> </li> </ul> <p> Hi Gunter, </p> <p> I fear we need to reopen the bug. In Debug the same linker error as reported occurs because BOOST_UBLAS_INLINE is not defined to inline at all. </p> <blockquote> <p> Therefore I suggest attributing the free functions with inline explicitely, unless someone knows a better solution. </p> </blockquote> <p> best regards, Christoph </p> Ticket anonymous Fri, 09 Oct 2009 18:00:56 GMT <link>https://svn.boost.org/trac10/ticket/3501#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3501#comment:6</guid> <description> <p> In config.hpp you can find the lines </p> <pre class="wiki">#ifdef NDEBUG #ifndef BOOST_UBLAS_INLINE #define BOOST_UBLAS_INLINE inline #endif ... </pre><p> This means that inline is disabled in debug builds in order to be able to follow the execution path. Explicitely defining </p> <pre class="wiki">#define BOOST_UBLAS_INLINE inline </pre><p> before including any uBLAS header should solve the problem. </p> </description> <category>Ticket</category> </item> <item> <author>christoph.heindl@…</author> <pubDate>Fri, 09 Oct 2009 19:10:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3501#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3501#comment:7</guid> <description> <p> It would solve the problem indeed. </p> <p> I wonder, however, if requiring the user to do the bugfixing for a third-party library in his code is the best way to handle this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Wed, 28 Oct 2009 21:07:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3501#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3501#comment:8</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/57202" title="see #3501: Reusing concepts from different compile units yields ...">[57202]</a>) see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3501" title="#3501: Bugs: Reusing concepts from different compile units yields multiple defined ... (closed: fixed)">#3501</a>: Reusing concepts from different compile units yields multiple defined symbols (Incomplete) </p> <ul><li>removed inlines that were added with the last commit </li><li>added anonymous namespace to make functions local to compilation unit </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Wed, 28 Oct 2009 22:54:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3501#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3501#comment:9</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/57208" title="see #3501: Reusing concepts from different compile units yields ...">[57208]</a>) see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3501" title="#3501: Bugs: Reusing concepts from different compile units yields multiple defined ... (closed: fixed)">#3501</a>: Reusing concepts from different compile units yields multiple defined symbols (Incomplete) </p> <ul><li>updated documentation </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Tue, 06 Apr 2010 20:15:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3501#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3501#comment:10</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/61114" title="see #3501: moved release note entry to correct release ">[61114]</a>) see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3501" title="#3501: Bugs: Reusing concepts from different compile units yields multiple defined ... (closed: fixed)">#3501</a>: moved release note entry to correct release </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Tue, 06 Apr 2010 20:18:15 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3501#comment:11 https://svn.boost.org/trac10/ticket/3501#comment:11 <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/61115" title="fix #3501: merge changes 57202,57208,61114 into release ...">[61115]</a>) fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3501" title="#3501: Bugs: Reusing concepts from different compile units yields multiple defined ... (closed: fixed)">#3501</a>: merge changes 57202,57208,61114 into release </p> <p> boost/numeric/ublas/detail/concepts.hpp libs/numeric/ublas/doc/release_notes.htm </p> Ticket