Boost C++ Libraries: Ticket #10487: Multiple definitions of boost::numeric::odeint::detail::* by multiple #include https://svn.boost.org/trac10/ticket/10487 <p> Dear all, </p> <p> I encountered a linker problem within the odeint code of library boost::numeric with boost 1.56 on Debian 32 bit with gcc 4.7. There (and I guess on many other compilers) will be multiple definitions of functions. The error is known not to occur with version 1.55.0. </p> <p> When using several inclusions of the following files in various code file </p> <p> #include &lt;boost/numeric/odeint/stepper/euler.hpp&gt; #include &lt;boost/numeric/odeint/stepper/runge_kutta4.hpp&gt; #include &lt;boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp&gt; </p> <p> the linker produces an error of multiple definitions for boost::numeric::odeint::detail. </p> <p> This linker problem will not occur if only one .cpp file #includes this file. </p> <p> Possible explanation taken from bug number 7678: </p> <p> Seemingly compiling each compile unit like foo.cpp, bar.cpp, etc. produces a definition into its individual .obj-file, namely foo.obj, bar.obj, etc.. Later the linker can not resolve which of the multiple definitions of "belongs", the one in foo.obj or the one in bar.obj, to take when binding the executable. </p> <p> CMake log: </p> <p> Linking CXX executable run_all_tests XXXXXXXXXXX/libXXXXXXXXXXX_static.a(FILE_YYYYYYYYYYYYY.cpp.o):(.bss+0x0): multiple definition of `boost::numeric::odeint::detail::_2' src/FILE_ZZZZZZZZZZZ.cpp.o:(.bss+0x10): first defined here XXXXXXXXXXX/libXXXXXXXXXXX_static.a(FILE_YYYYYYYYYYYYY.cpp.o):(.bss+0x1): multiple definition of `boost::numeric::odeint::detail::_1' src/FILE_ZZZZZZZZZZZ.cpp.o:(.bss+0x11): first defined here collect2: error: ld returned 1 exit status </p> <p> The bug is similar to the one described here </p> <p> <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/7678"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/7678</a> </p> <p> Guillaume Jacquenot </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10487 Trac 1.4.3 guillaume.jacquenot@… Thu, 11 Sep 2014 09:41:20 GMT summary changed; cc set https://svn.boost.org/trac10/ticket/10487#comment:1 https://svn.boost.org/trac10/ticket/10487#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">guillaume.jacquenot@…</span> added </li> <li><strong>summary</strong> <span class="trac-field-old">Multiple definitions of bool boost::numeric::odeint by multiple #include</span> → <span class="trac-field-new">Multiple definitions of boost::numeric::odeint::detail::* by multiple #include</span> </li> </ul> Ticket karsten Tue, 11 Nov 2014 16:37:23 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10487#comment:2 https://svn.boost.org/trac10/ticket/10487#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> Already fixed in <a class="ext-link" href="https://github.com/headmyshoulder/odeint-v2"><span class="icon">​</span>https://github.com/headmyshoulder/odeint-v2</a> </p> <p> The fix will apear in Boost 1.58. </p> Ticket telcom Tue, 02 Dec 2014 16:29:01 GMT <link>https://svn.boost.org/trac10/ticket/10487#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10487#comment:3</guid> <description> <p> The same issue exists in Visual Studio 2012 C++11, Boost 1.56. Possible temporary solution is, getting odeint-v2 from gitub and replace the following folders and file in the include path of numeric: ~/numeric/odeint :: folder odeint.hpp :: file </p> <p> Tested and verified. </p> </description> <category>Ticket</category> </item> </channel> </rss>