Boost C++ Libraries: Ticket #6010: Linkage problems in assignment.hpp https://svn.boost.org/trac10/ticket/6010 <p> Original report in uBlas mailing list: </p> <pre class="wiki">Hi, I started using ublas's "&lt;&lt;=" assignment, and I'm starting to regret it. First symptom: if I compile with the gcc flag -Wmissing-prototypes I get the following warnings: In file included from /Users/devernay/Development/stereocam/surf/CameraMatrixP.hpp:16, from /Users/devernay/Development/stereocam/surf/TriFocalTensor/Trifocaltensor.hpp:18, from /Users/devernay/Development/stereocam/surf/TriFocalTensor/TrifocaltensorBundleAdjustement.cpp:20: /opt/local/include/boost/numeric/ublas/assignment.hpp:454: warning: no previous prototype for 'boost::numeric::ublas::begin1_manip boost::numeric::ublas::begin1()' /opt/local/include/boost/numeric/ublas/assignment.hpp:498: warning: no previous prototype for 'boost::numeric::ublas::begin2_manip boost::numeric::ublas::begin2()' /opt/local/include/boost/numeric/ublas/assignment.hpp:543: warning: no previous prototype for 'boost::numeric::ublas::next_row_manip boost::numeric::ublas::next_row()' /opt/local/include/boost/numeric/ublas/assignment.hpp:587: warning: no previous prototype for 'boost::numeric::ublas::next_column_manip boost::numeric::ublas::next_column()' /opt/local/include/boost/numeric/ublas/assignment.hpp:888: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy&lt;boost::numeric::ublas::traverse_policy::wrap&gt; boost::numeric::ublas::traverse_policy::by_row()' /opt/local/include/boost/numeric/ublas/assignment.hpp:892: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy&lt;boost::numeric::ublas::traverse_policy::wrap&gt; boost::numeric::ublas::traverse_policy::by_row_wrap()' /opt/local/include/boost/numeric/ublas/assignment.hpp:896: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_row_policy&lt;boost::numeric::ublas::traverse_policy::no_wrap&gt; boost::numeric::ublas::traverse_policy::by_row_no_wrap()' /opt/local/include/boost/numeric/ublas/assignment.hpp:900: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy&lt;boost::numeric::ublas::traverse_policy::wrap&gt; boost::numeric::ublas::traverse_policy::by_column()' /opt/local/include/boost/numeric/ublas/assignment.hpp:904: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy&lt;boost::numeric::ublas::traverse_policy::wrap&gt; boost::numeric::ublas::traverse_policy::by_column_wrap()' /opt/local/include/boost/numeric/ublas/assignment.hpp:908: warning: no previous prototype for 'boost::numeric::ublas::traverse_policy::by_column_policy&lt;boost::numeric::ublas::traverse_policy::no_wrap&gt; boost::numeric::ublas::traverse_policy::by_column_no_wrap()' But the second symptom is more critical: Since these symbols are defined in EVERY file that includes them, I cannot link anything and I get tons of "multiply defined symbols". Looking at the file, I found out that: - begin1(), begin2(), and a few others are not inlined, but conditionally inlined, using BOOST_UBLAS_INLINE (which inlines only if NDEBUG is defined), and are NOT members of classes, thus the multiply defined symbols... - boost::numeric::ublas::traverse_policy::by_row() and other are just defined, and not inlined. So, really, what's the solution? Here's what I think: BOOST_UBLAS_INLINE should ONY be used for class members, NOT for functions, which should be simply declared "inline". by_row() and friends should either be inlined or declared as static members of an empty class. I tried putting the magic word "inline" in front of each of these, and it works. fred </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6010 Trac 1.4.3 nasos_i@… Tue, 11 Oct 2011 18:04:58 GMT attachment set https://svn.boost.org/trac10/ticket/6010 https://svn.boost.org/trac10/ticket/6010 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">assignment11102011.patch</span> </li> </ul> <p> assignment.hpp patch </p> Ticket nasos_i@… Tue, 11 Oct 2011 18:20:21 GMT <link>https://svn.boost.org/trac10/ticket/6010#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6010#comment:1</guid> <description> <p> assignment11102011.patch applies the suggested inlines on the non-template functions of assignment.hpp and seems it resolves the linkage problems. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>David Bellot</dc:creator> <pubDate>Thu, 17 Nov 2011 00:16:59 GMT</pubDate> <title>owner, status changed https://svn.boost.org/trac10/ticket/6010#comment:2 https://svn.boost.org/trac10/ticket/6010#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Gunter</span> to <span class="trac-author">David Bellot</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> fixed </p> Ticket David Bellot Thu, 17 Nov 2011 00:17:15 GMT status changed https://svn.boost.org/trac10/ticket/6010#comment:3 https://svn.boost.org/trac10/ticket/6010#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> </ul> Ticket David Bellot Thu, 17 Nov 2011 00:17:39 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6010#comment:4 https://svn.boost.org/trac10/ticket/6010#comment:4 <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> Ticket jeremy.coulon@… Thu, 28 Jun 2012 19:20:30 GMT <link>https://svn.boost.org/trac10/ticket/6010#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6010#comment:5</guid> <description> <p> Shouldn't it be fixed in Boost 1.48 ? This bug is still there in the latest Boost 1.50 ! It looks like the patch has not been applied. </p> </description> <category>Ticket</category> </item> <item> <author>jeremy.coulon@…</author> <pubDate>Thu, 24 Jan 2013 19:45:32 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/6010#comment:6 https://svn.boost.org/trac10/ticket/6010#comment:6 <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> Bug still there in 1.52. </p> Ticket