c++ - Quantlib 1.5 构建

标签 c++ boost quantlib

在CentOS 7下,我使用的是

[idf@node2 QuantLib-1.5]$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.1-20140922/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.1-20140922/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.9.1 20140922 (Red Hat 4.9.1-10) (GCC) 
[idf@node2 QuantLib-1.5]$ 

使用 Boost.1_58,我在构建 QL 1.5 时遇到以下错误

Making all in math
make[4]: Entering directory `/mnt/gluster/Downloads/QuantLib-1.5/ql/experimental/math'
/bin/sh ../../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../ql  -I../../.. -I../../..   -g -O2 -MT convolvedstudentt.lo -MD -MP -MF .deps/convolvedstudentt.Tpo -c -o convolvedstudentt.lo convolvedstudentt.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../../ql -I../../.. -I../../.. -g -O2 -MT convolvedstudentt.lo -MD -MP -MF .deps/convolvedstudentt.Tpo -c convolvedstudentt.cpp  -fPIC -DPIC -o .libs/convolvedstudentt.o
convolvedstudentt.cpp: In member function 'QuantLib::Real QuantLib::InverseCumulativeBehrensFisher::operator()(QuantLib::Probability) const':
convolvedstudentt.cpp:194:29: error: call of overloaded 'bind(QuantLib::Probability (QuantLib::CumulativeBehrensFisher::*)(QuantLib::Real) const, QuantLib::CumulativeBehrensFisher&, boost::arg<1>&)' is ambiguous
                 distrib_, _1)), accuracy_, (xMin+xMax)/2., xMin, xMax);
                             ^
convolvedstudentt.cpp:194:29: note: candidates are:
In file included from /usr/local/include/boost/bind.hpp:22:0,
                 from convolvedstudentt.cpp:30:
/usr/local/include/boost/bind/bind.hpp:1602:5: note: boost::_bi::bind_t<R, F, typename boost::_bi::list_av_2<A1, A2>::type> boost::bind(F, A1, A2) [with R = double; F = double (QuantLib::CumulativeBehrensFisher::*)(double) const; A1 = QuantLib::CumulativeBehrensFisher; A2 = boost::arg<1>; typename boost::_bi::list_av_2<A1, A2>::type = boost::_bi::list2<boost::_bi::value<QuantLib::CumulativeBehrensFisher>, boost::arg<1> >]
     BOOST_BIND(F f, A1 a1, A2 a2)
     ^
/usr/local/include/boost/bind/bind_mf_cc.hpp:74:5: note: boost::_bi::bind_t<R, boost::_mfi::cmf1<R, T, A1>, typename boost::_bi::list_av_2<A1, A2>::type> boost::bind(R (T::*)(B1) const, A1, A2) [with R = double; T = QuantLib::CumulativeBehrensFisher; B1 = double; A1 = QuantLib::CumulativeBehrensFisher; A2 = boost::arg<1>; typename boost::_bi::list_av_2<A1, A2>::type = boost::_bi::list2<boost::_bi::value<QuantLib::CumulativeBehrensFisher>, boost::arg<1> >]
     BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2)
     ^
/usr/local/include/boost/bind/bind_mf_cc.hpp:96:5: note: boost::_bi::bind_t<Rt2, boost::_mfi::cmf1<R, T, B1>, typename boost::_bi::list_av_2<A1, A2>::type> boost::bind(R (T::*)(B1) const, A1, A2) [with Rt2 = double; R = double; T = QuantLib::CumulativeBehrensFisher; B1 = double; A1 = QuantLib::CumulativeBehrensFisher; A2 = boost::arg<1>; typename boost::_bi::list_av_2<A1, A2>::type = boost::_bi::list2<boost::_bi::value<QuantLib::CumulativeBehrensFisher>, boost::arg<1> >]
     BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2)
     ^
make[4]: *** [convolvedstudentt.lo] Error 1
make[4]: Leaving directory `/mnt/gluster/Downloads/QuantLib-1.5/ql/experimental/math'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/mnt/gluster/Downloads/QuantLib-1.5/ql/experimental'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/mnt/gluster/Downloads/QuantLib-1.5/ql'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/mnt/gluster/Downloads/QuantLib-1.5/ql'
make: *** [all-recursive] Error 1
[idf@node2 QuantLib-1.5]$ 

[idf@node2 math]$ make
/bin/sh ../../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../ql  -I../../.. -I../../..   -g -O2 -MT convolvedstudentt.lo -MD -MP -MF .deps/convolvedstudentt.Tpo -c -o convolvedstudentt.lo convolvedstudentt.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../../ql -I../../.. -I../../.. -g -O2 -MT convolvedstudentt.lo -MD -MP -MF .deps/convolvedstudentt.Tpo -c convolvedstudentt.cpp  -fPIC -DPIC -o .libs/convolvedstudentt.o
convolvedstudentt.cpp: In member function 'QuantLib::Real QuantLib::InverseCumulativeBehrensFisher::operator()(QuantLib::Probability) const':
convolvedstudentt.cpp:194:54: error: wrong type argument to unary minus
 -                &CumulativeBehrensFisher::operator (),
                                                      ^
convolvedstudentt.cpp:196:53: error: wrong type argument to unary plus
 +                &CumulativeBehrensFisher::operator(),
                                                     ^
make: *** [convolvedstudentt.lo] Error 1
[idf@node2 math]$ 

最佳答案

参见 quantlib users mailing list以及最近的一些消息——简而言之,Boost 1.58(在 QuantLib 1.5 之后发布)产生了一些问题,因此您最好的猜测可能是坚持使用 Boost 1.57。

另一方面,如果您想坚持使用 Boost 1.58,请尝试 this patch .

关于c++ - Quantlib 1.5 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30294288/

相关文章:

c++ - ABI稳定性: When do I break ABI?

c++ - 需要UDP端口转发吗?

c++ - boost::async_write 跳过部分字符串

Qt 相当于 boost::shared_from_this?

c++ - 如何使用boost属性树使用boost解析json字符串中数组中的元素?

c++ - QuantLib 中的掉期定价

c++ - 将日期 std::string 转换为 QuantLib::Date 对象

c++ - 如何将 Ubuntu C++ 库移植到 MinGW?

c# - 从 C# 调用 QuantLib 方法的最佳方式是什么

c++ - 使用 `operator` 关键字是什么意思?