c++ - gcc/mingw linker fails with "first defined here" when using boost and quantlib - is it my fault? -
after upgrading gcc 4.8 on windows box, code no longer builds, linker fails. there 14 identical error messages, first 1 is:
[mingw]\local\lib/libquantlib.a(normaldistribution.o):normaldistribution.cpp:(.data$_zzn5boost4math6detail11erf_inv_impiens0_8policies6policyins3_13promote_floatilb0eeens3_14promote_doubleilb0eeens3_14default_policyes9_s9_s9_s9_s9_s9_s9_s9_s9_s9_eeeet_rksb_sd_rkt0_pkn4mpl_4int_ili64eeee1p[_zzn5boost4math6detail11erf_inv_impiens0_8policies6policyins3_13promote_floatilb0eeens3_14promote_doubleilb0eeens3_14default_policyes9_s9_s9_s9_s9_s9_s9_s9_s9_s9_eeeet_rksb_sd_rkt0_pkn4mpl_4int_ili64eeee1p]+0x0): multiple definition of `long double boost::math::detail::erf_inv_imp, boost::math::policies::promote_double, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy> >(long double const&, long double const&, boost::math::policies::policy, boost::math::policies::promote_double, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy> const&, mpl_::int_<64> const*)::p' .obj\debug\margin-distrib.o:margin-distrib.cpp:(.rdata$_zzn5boost4math6detail11erf_inv_impiens0_8policies6policyins3_13promote_floatilb0eeens3_14promote_doubleilb0eeens3_14default_policyes9_s9_s9_s9_s9_s9_s9_s9_s9_s9_eeeet_rksb_sd_rkt0_pkn4mpl_4int_ili64eeee1p[_zzn5boost4math6detail11erf_inv_impiens0_8policies6policyins3_13promote_floatilb0eeens3_14promote_doubleilb0eeens3_14default_policyes9_s9_s9_s9_s9_s9_s9_s9_s9_s9_eeeet_rksb_sd_rkt0_pkn4mpl_4int_ili64eeee1p]+0x0): first defined here
and ends with
collect2.exe: error: ld returned 1 exit status
i have found can "solve" -wl,--allow-multiple-definition
gcc option, have feeling hides problem. understand going on and, in particular, whether fault.
now, margin-distrib.cpp using 3 distributions boost::math, quantlib's normaldistribution.cpp. therefore natural both end calling same boost functions. since these boost libraries header-only, looks functions end in both quanlib's dll , .o file, linker not like.
interestingly, not happen on linux, code builds without problems - because using older versions of both boost , quantlib there.
so, doing wrong, or problem in libraries?
Comments
Post a Comment