pBook‎ > ‎Solver:: Integrator:: C++‎ > ‎

Bug in odeint in Boost below 1.58

posted Dec 2, 2014, 8:32 AM by Javad Taghia   [ updated Dec 2, 2014, 8:33 AM ]

Multiple definitions of boost::numeric::odeint::detail::* by multiple #include

Reported by:guillaume.jacquenot@…Owned by:karsten
Milestone:Boost 1.57.0Component:odeint
Version:Boost 1.56.0Severity:Problem


Dear all,

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.

When using several inclusions of the following files in various code file

#include <boost/numeric/odeint/stepper/euler.hpp> #include <boost/numeric/odeint/stepper/runge_kutta4.hpp> #include <boost/numeric/odeint/stepper/runge_kutta_cash_karp54.hpp>

the linker produces an error of multiple definitions for boost::numeric::odeint::detail.

This linker problem will not occur if only one .cpp file #includes this file.

Possible explanation taken from bug number 7678:

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.

CMake log:

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

The bug is similar to the one described here


Guillaume Jacquenot

Change History

comment:1Changed 3 months ago by guillaume.jacquenot@…

  • Cc guillaume.jacquenot@… added
  • Summary changed from Multiple definitions of bool boost::numeric::odeint by multiple #include toMultiple definitions of boost::numeric::odeint::detail::* by multiple #include

comment:2Changed 3 weeks ago by karsten

  • Status changed from new to closed
  • Resolution set to fixed

Already fixed in  https://github.com/headmyshoulder/odeint-v2

The fix will apear in Boost 1.58.

comment:3Changed 1 second ago by telcom

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

Tested and verified.

Javad Taghia,
Dec 2, 2014, 8:33 AM