将 boost 用于 TR1 时,boost math 特殊函数编译错误
Posted
技术标签:
【中文标题】将 boost 用于 TR1 时,boost math 特殊函数编译错误【英文标题】:boost math special functions compilation error when using boost for TR1 【发布时间】:2012-12-19 15:27:24 【问题描述】:我一直在将依赖于 boost 1.43 的已经工作的项目升级到 boost 1.52。编译时,我在数学特殊函数标题中收到一组奇怪的错误。不幸的是,我无法从下面的输出中找出导致它的代码。由于DisplayWindow.h
和DisplayWindow.cpp
不使用这些数学函数,数学错误似乎突然出现。 Linux 上的编译器是 gcc 4.1.2。 boost 1.51 也是如此。有谁知道可能导致问题的原因?
我不确定这是否重要——我正在使用 boost 作为here 中描述的 TR1 插件。
In file included from /home/p/plau/include/boost/fusion/tuple/tuple.hpp:22,
from /home/p/plau/include/boost/fusion/tuple.hpp:10,
from /home/p/plau/include/boost/fusion/include/tuple.hpp:10,
from /home/p/plau/include/boost/tr1/tuple.hpp:58,
from /home/p/plau/include/boost/tr1/utility.hpp:117,
from /home/p/plau/include/boost/tr1/tr1/utility:38,
from /home/p/plau/include/boost/serialization/nvp.hpp:19,
from /home/p/plau/include/boost/bimap/bimap.hpp:57,
from /home/p/plau/include/boost/bimap.hpp:13,
from /home/p/plau/include/rlearn/Action.h:13,
from /home/p/plau/include/rlearn/EnvWrapper.h:5,
from ./rlsiva/DisplayWindow.h:9,
from src/DisplayWindow.cpp:1:
/home/p/plau/include/boost/fusion/tuple/detail/preprocessed/tuple.hpp:21:7: warning: no newline at end of file
/home/p/plau/include/boost/math/special_functions/trunc.hpp: In function T boost::math::trunc(const T&, const Policy&):
/home/p/plau/include/boost/math/special_functions/trunc.hpp:24: error: raise_rounding_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/trunc.hpp: In function int boost::math::itrunc(const T&, const Policy&):
/home/p/plau/include/boost/math/special_functions/trunc.hpp:47: error: raise_rounding_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/trunc.hpp: In function long int boost::math::ltrunc(const T&, const Policy&):
/home/p/plau/include/boost/math/special_functions/trunc.hpp:62: error: raise_rounding_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/trunc.hpp: In function boost::long_long_type boost::math::lltrunc(const T&, const Policy&):
/home/p/plau/include/boost/math/special_functions/trunc.hpp:79: error: raise_rounding_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function T boost::math::detail::log1p_imp(const T&, const Policy&, const mpl_::int_<0>&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:82: error: raise_domain_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:82: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:85: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:85: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:103: error: check_series_iterations is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:103: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function T boost::math::detail::log1p_imp(const T&, const Policy&, const mpl_::int_<53>&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:115: error: raise_domain_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:115: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:118: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:118: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function T boost::math::detail::log1p_imp(const T&, const Policy&, const mpl_::int_<64>&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:168: error: raise_domain_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:168: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:171: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:171: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function T boost::math::detail::log1p_imp(const T&, const Policy&, const mpl_::int_<24>&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:223: error: raise_domain_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:223: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:226: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:226: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function typename boost::math::tools::promote_args<T, float, float, float, float, float>::type boost::math::log1p(T, const Policy&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:320: error: checked_narrowing_cast is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:320: error: expected primary-expression before , token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:320: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function float boost::math::log1p(float, const Policy&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:355: error: raise_domain_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:355: error: expected primary-expression before float
/home/p/plau/include/boost/math/special_functions/log1p.hpp:355: error: expected ; before float
/home/p/plau/include/boost/math/special_functions/log1p.hpp:355: error: expected unqualified-id before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:358: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:358: error: expected primary-expression before float
/home/p/plau/include/boost/math/special_functions/log1p.hpp:358: error: expected ; before float
/home/p/plau/include/boost/math/special_functions/log1p.hpp:358: error: expected unqualified-id before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function long double boost::math::log1p(long double, const Policy&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:367: error: raise_domain_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:367: error: expected primary-expression before long
/home/p/plau/include/boost/math/special_functions/log1p.hpp:367: error: expected ; before long
/home/p/plau/include/boost/math/special_functions/log1p.hpp:367: error: expected unqualified-id before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:370: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:370: error: expected primary-expression before long
/home/p/plau/include/boost/math/special_functions/log1p.hpp:370: error: expected ; before long
/home/p/plau/include/boost/math/special_functions/log1p.hpp:370: error: expected unqualified-id before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function double boost::math::log1p(double, const Policy&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:392: error: raise_domain_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:392: error: expected primary-expression before double
/home/p/plau/include/boost/math/special_functions/log1p.hpp:392: error: expected ; before double
/home/p/plau/include/boost/math/special_functions/log1p.hpp:392: error: expected unqualified-id before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:395: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:395: error: expected primary-expression before double
/home/p/plau/include/boost/math/special_functions/log1p.hpp:395: error: expected ; before double
/home/p/plau/include/boost/math/special_functions/log1p.hpp:395: error: expected unqualified-id before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp: In function typename boost::math::tools::promote_args<T, float, float, float, float, float>::type boost::math::log1pmx(T, const Policy&):
/home/p/plau/include/boost/math/special_functions/log1p.hpp:465: error: raise_domain_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:465: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:468: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:468: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/log1p.hpp:487: error: check_series_iterations is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/log1p.hpp:487: error: expected primary-expression before > token
/home/p/plau/include/boost/math/special_functions/hypot.hpp: In function T boost::math::detail::hypot_imp(T, T, const Policy&):
/home/p/plau/include/boost/math/special_functions/hypot.hpp:45: error: raise_overflow_error is not a member of boost::math::policies
/home/p/plau/include/boost/math/special_functions/hypot.hpp:45: error: expected primary-expression before > token
make: *** [../../objs/rlsiva/release/DisplayWindow.o] Error 1
make: Leaving directory `/home/p/plau/retina/project/components/rlsiva'
更新:尝试在 Windows 上使用 mingw-gcc 4.7 和 boost 1.52 编译相同的代码会得到以下输出。
In file included from e:/code/boost_1_52_0/boost/math/constants/calculate_constants.hpp:11:0,
from e:/code/boost_1_52_0/boost/math/constants/constants.hpp:288,
from e:/code/boost_1_52_0/boost/math/complex/details.hpp:22,
from e:/code/boost_1_52_0/boost/math/complex/asin.hpp:9,
from e:/code/boost_1_52_0/boost/math/complex.hpp:10,
from e:/code/boost_1_52_0/boost/tr1/complex.hpp:13,
from e:/code/boost_1_52_0/boost/tr1/tr1/complex:28,
from e:/code/boost_1_52_0/boost/math/policies/error_handling.hpp:15,
from e:/code/boost_1_52_0/boost/math/special_functions/gamma.hpp:32,
from e:/code/boost_1_52_0/boost/math/special_functions/detail/bessel_jy.hpp:14,
from e:/code/boost_1_52_0/boost/math/special_functions/bessel.hpp:17,
from e:/code/boost_1_52_0/boost/math/special_functions/airy.hpp:10,
from e:/code/boost_1_52_0/boost/math/special_functions.hpp:15,
from e:/code/boost_1_52_0/boost/random/generate_canonical.hpp:22,
from e:/code/boost_1_52_0/boost/random.hpp:52,
from e:/games/rlearn/rlearn/Random.h:4,
from e:/games/rlearn/rlearn/Comparators.h:4,
from e:/games/rlearn/rlearn/function/StoredActionFunction.h:5,
from e:/games/rlearn/rlearn/ValueFunction.h:18,
from e:/games/rlearn/rlearn/Extractor.h:8,
from e:/games/rlearn/rlearn/DataStructures.h:7,
from ./rlsiva/SivaController.h:5,
from src/DisplayWindow.cpp:3:
e:/code/boost_1_52_0/boost/math/special_functions/trunc.hpp: In function 'T boost::math::trunc(const T&, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/trunc.hpp:24:14: error: 'raise_rounding_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/trunc.hpp: In function 'int boost::math::itrunc(const T&, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/trunc.hpp:47:31: error: 'raise_rounding_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/trunc.hpp: In function 'long int boost::math::ltrunc(const T&, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/trunc.hpp:62:32: error: 'raise_rounding_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/trunc.hpp: In function 'boost::long_long_type boost::math::lltrunc(const T&, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/trunc.hpp:79:49: error: 'raise_rounding_error' is not a member of 'boost::math::policies'
In file included from e:/code/boost_1_52_0/boost/math/complex/asin.hpp:12:0,
from e:/code/boost_1_52_0/boost/math/complex.hpp:10,
from e:/code/boost_1_52_0/boost/tr1/complex.hpp:13,
from e:/code/boost_1_52_0/boost/tr1/tr1/complex:28,
from e:/code/boost_1_52_0/boost/math/policies/error_handling.hpp:15,
from e:/code/boost_1_52_0/boost/math/special_functions/gamma.hpp:32,
from e:/code/boost_1_52_0/boost/math/special_functions/detail/bessel_jy.hpp:14,
from e:/code/boost_1_52_0/boost/math/special_functions/bessel.hpp:17,
from e:/code/boost_1_52_0/boost/math/special_functions/airy.hpp:10,
from e:/code/boost_1_52_0/boost/math/special_functions.hpp:15,
from e:/code/boost_1_52_0/boost/random/generate_canonical.hpp:22,
from e:/code/boost_1_52_0/boost/random.hpp:52,
from e:/games/rlearn/rlearn/Random.h:4,
from e:/games/rlearn/rlearn/Comparators.h:4,
from e:/games/rlearn/rlearn/function/StoredActionFunction.h:5,
from e:/games/rlearn/rlearn/ValueFunction.h:18,
from e:/games/rlearn/rlearn/Extractor.h:8,
from e:/games/rlearn/rlearn/DataStructures.h:7,
from ./rlsiva/SivaController.h:5,
from src/DisplayWindow.cpp:3:
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'T boost::math::detail::log1p_imp(const T&, const Policy&, const mpl_::int_<0>&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:82:14: error: 'raise_domain_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:82:44: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:85:15: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:85:47: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:103:4: error: 'check_series_iterations' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:103:39: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'T boost::math::detail::log1p_imp(const T&, const Policy&, const mpl_::int_<53>&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:115:14: error: 'raise_domain_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:115:44: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:118:15: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:118:47: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'T boost::math::detail::log1p_imp(const T&, const Policy&, const mpl_::int_<64>&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:168:14: error: 'raise_domain_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:168:44: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:171:15: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:171:47: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'T boost::math::detail::log1p_imp(const T&, const Policy&, const mpl_::int_<24>&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:223:14: error: 'raise_domain_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:223:44: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:226:15: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:226:47: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'typename boost::math::tools::promote_args<RT>::type boost::math::log1p(T, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:320:11: error: 'checked_narrowing_cast' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:320:55: error: expected primary-expression before ',' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:320:74: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'float boost::math::log1p(float, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:355:14: error: 'raise_domain_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:355:43: error: expected primary-expression before 'float'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:355:43: error: expected ';' before 'float'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:355:48: error: expected unqualified-id before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:358:15: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:358:46: error: expected primary-expression before 'float'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:358:46: error: expected ';' before 'float'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:358:51: error: expected unqualified-id before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'long double boost::math::log1p(long double, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:367:14: error: 'raise_domain_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:367:43: error: expected primary-expression before 'long'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:367:43: error: expected ';' before 'long'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:367:54: error: expected unqualified-id before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:370:15: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:370:46: error: expected primary-expression before 'long'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:370:46: error: expected ';' before 'long'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:370:57: error: expected unqualified-id before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'double boost::math::log1p(double, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:392:14: error: 'raise_domain_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:392:43: error: expected primary-expression before 'double'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:392:43: error: expected ';' before 'double'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:392:49: error: expected unqualified-id before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:395:15: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:395:46: error: expected primary-expression before 'double'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:395:46: error: expected ';' before 'double'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:395:52: error: expected unqualified-id before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp: In function 'typename boost::math::tools::promote_args<RT>::type boost::math::log1pmx(T, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:465:14: error: 'raise_domain_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:465:44: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:468:15: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:468:47: error: expected primary-expression before '>' token
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:487:4: error: 'check_series_iterations' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/log1p.hpp:487:39: error: expected primary-expression before '>' token
In file included from e:/code/boost_1_52_0/boost/math/complex/fabs.hpp:10:0,
from e:/code/boost_1_52_0/boost/math/complex.hpp:28,
from e:/code/boost_1_52_0/boost/tr1/complex.hpp:13,
from e:/code/boost_1_52_0/boost/tr1/tr1/complex:28,
from e:/code/boost_1_52_0/boost/math/policies/error_handling.hpp:15,
from e:/code/boost_1_52_0/boost/math/special_functions/gamma.hpp:32,
from e:/code/boost_1_52_0/boost/math/special_functions/detail/bessel_jy.hpp:14,
from e:/code/boost_1_52_0/boost/math/special_functions/bessel.hpp:17,
from e:/code/boost_1_52_0/boost/math/special_functions/airy.hpp:10,
from e:/code/boost_1_52_0/boost/math/special_functions.hpp:15,
from e:/code/boost_1_52_0/boost/random/generate_canonical.hpp:22,
from e:/code/boost_1_52_0/boost/random.hpp:52,
from e:/games/rlearn/rlearn/Random.h:4,
from e:/games/rlearn/rlearn/Comparators.h:4,
from e:/games/rlearn/rlearn/function/StoredActionFunction.h:5,
from e:/games/rlearn/rlearn/ValueFunction.h:18,
from e:/games/rlearn/rlearn/Extractor.h:8,
from e:/games/rlearn/rlearn/DataStructures.h:7,
from ./rlsiva/SivaController.h:5,
from src/DisplayWindow.cpp:3:
e:/code/boost_1_52_0/boost/math/special_functions/hypot.hpp: In function 'T boost::math::detail::hypot_imp(T, T, const Policy&)':
e:/code/boost_1_52_0/boost/math/special_functions/hypot.hpp:45:14: error: 'raise_overflow_error' is not a member of 'boost::math::policies'
e:/code/boost_1_52_0/boost/math/special_functions/hypot.hpp:45:46: error: expected primary-expression before '>' token
make: *** [../../objs/rlsiva/release/DisplayWindow.o] Error 1
make: Leaving directory `/e/retina/project/components/rlsiva'
UPDATE2:使用 VC 的 TR1 支持,相同的代码在 VC10 的 Windows 上编译良好。
【问题讨论】:
这很容易由类或结构的定义末尾缺少分号或文件中缺少括号引起。 我正在升级一个已经在运行的项目。该程序与之前的 boost 1.43 编译良好,唯一改变的是 boost 库到 1.52 GCC 4.1.2 于 2007 年 2 月 13 日发布。那已经很老了! 不幸的是我必须使用它。该手册说它已经在 gcc 3.4 及更高版本上进行了测试。 boost.org/doc/libs/1_52_0/libs/math/doc/sf_and_dist/html/… 【参考方案1】:我在我们的代码中看到了相同类型的错误消息,并且可以通过这个示例重现它们:
#include<boost/random.hpp>
#include<iostream>
int main()
boost::random::mt19937 ranGen(std::time(0));
boost::uniform_int<> dist(1, 50);
std::cout << dist(randGen) << std::endl;
return 0;
使用相同的 TR1 插入方法编译时:
g++ tst.cpp -I/path/to/boost/include/boost/tr1/tr1 -I/path/to/boost/include
使用 boost 1.52.0 和 gcc 4.4.6。
在我们的例子中,boost/random.hpp
涵盖了我们需要的功能,但也包括最终导致这些奇怪的编译器错误的其他标头。
我们可以通过替换来解决这个问题
#include<boost/random.hpp>
更具体地满足我们的需求:
#include<boost/random/mersenne_twister.hpp>
#include<boost/random/uniform_int.hpp>
#include<ctime>
因此省略了有问题的标题。
对于random.hpp
和bimap.hpp
的使用,您也许可以使用相同的解决方法。
【讨论】:
以上是关于将 boost 用于 TR1 时,boost math 特殊函数编译错误的主要内容,如果未能解决你的问题,请参考以下文章
std::bind 是不是应该与 boost::asio 兼容?