0

Here is the C++ code taken from odeint documentation:

https://raw.githubusercontent.com/headmyshoulder/odeint-v2/master/examples/gmpxx/lorenz_gmpxx.cpp

After compile and link through the following command:

g++ -Wall -o lorenz_gmpxx lorenz_gmpxx.cpp

I am receiving this error message:

> > In file included from /usr/include/boost/numeric/odeint/integrate/integrate_adaptive.hpp:25:0,
                 from /usr/include/boost/numeric/odeint/integrate/integrate.hpp:24,
                 from /usr/include/boost/numeric/odeint.hpp:64,
                 from lorenz_gmpxx.cpp:21:
/usr/include/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp: In instantiation of ‘size_t boost::numeric::odeint::detail::integrate_adaptive(Stepper, System, State&, Time, Time, Time, Observer, boost::numeric::odeint::stepper_tag) [with Stepper = boost::numeric::odeint::runge_kutta4<boost::array<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, 3u>, __gmp_expr<__mpf_struct [1], __mpf_struct [1]> >; System = lorenz; State = boost::array<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, 3u>; Time = __gmp_expr<__mpf_struct [1], __mpf_struct [1]>; Observer = streaming_observer; size_t = unsigned int]’:
/usr/include/boost/numeric/odeint/integrate/integrate_const.hpp:53:65:   required from ‘size_t boost::numeric::odeint::integrate_const(Stepper, System, State&, Time, Time, Time, Observer) [with Stepper = boost::numeric::odeint::runge_kutta4<boost::array<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, 3u>, __gmp_expr<__mpf_struct [1], __mpf_struct [1]> >; System = lorenz; State = boost::array<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, 3u>; Time = __gmp_expr<__mpf_struct [1], __mpf_struct [1]>; Observer = streaming_observer; size_t = unsigned int]’
lorenz_gmpxx.cpp:79:40:   required from here
/usr/include/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp:57:68: error: invalid static_cast from type ‘__gmp_expr<__mpf_struct [1], __gmp_binary_expr<__gmp_expr<__mpf_struct [1], __gmp_binary_expr<__gmp_expr<__mpf_struct [1], __mpf_struct [1]>, __gmp_expr<__mpf_struct [1], __mpf_struct [1]>, __gmp_binary_minus> >, __gmp_expr<__mpf_struct [1], __mpf_struct [1]>, __gmp_binary_divides> >’ to type ‘size_t {aka unsigned int}’
     size_t steps = static_cast< size_t >( (end_time-start_time)/dt );

I would appreciate any help.

Benjamin
  • 145
  • 8
  • [Works for me](http://coliru.stacked-crooked.com/a/09d1dd4b1545e20b). What compiler version/boost version are you using? – Anton Savin May 05 '15 at 00:33
  • I am using GCC 4.9.2 20150212 (Red Hat 4.9.2-6) and Boost 1.55.0 – Benjamin May 05 '15 at 00:59
  • What does this mean? -Wextra -pedantic -pthread -lgmpxx -lgmp – Benjamin May 05 '15 at 01:03
  • I am thinking of adding more flags to my command line compile_link. Maybe it is not correct. – Benjamin May 05 '15 at 01:12
  • Also works for me with a current version of odeint from github. Which version of gmpxx are you using? – mariomulansky May 05 '15 at 17:01
  • I just noticed that I have gmp in my repository and installed but I cannot see gmpxx. Should I install it as a non-free package? Or can I modify the code in order to be able to see it work for gmp? I also did a search through "yum search gmpxx" and I couldn't find that in order to install it. – Benjamin May 06 '15 at 02:24

0 Answers0