0

Quantlib 已安装并在 /usr/local/include & lib 中正常工作。我在尝试构建 quantlib-swig 时遇到了很多错误。我在下面仅粘贴几个示例。

我相信这些可能是编译器而不是链接问题,但我不确定这是否正确或如何继续。

任何帮助和指示将不胜感激!谢谢!

MBP:Python timo$ python setup.py build

QuantLib/quantlib_wrap.cpp:5201:41: error: no member named 'parse' in 'QuantLib::DateParser'
        return new Date(DateParser::parse(str,fmt));
In file included from QuantLib/quantlib_wrap.cpp:3467:
In file included from /usr/local/include/ql/quantlib.hpp:47:
In file included from /usr/local/include/ql/math/all.hpp:35:
In file included from /usr/local/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4035:59: error: 'value_type' is a private member of
  'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >'
__val_expr<_BinaryOp<__bit_shift_left<typename _Expr::value_type>,
                                                      ^
QuantLib/quantlib_wrap.cpp:6170:23: note: while substituting deduced template arguments into function template 'operator<<' [with _Expr =
  boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >]
                s << (*self)[i][j];
                  ^
In file included from QuantLib/quantlib_wrap.cpp:3467:
In file included from /usr/local/include/ql/quantlib.hpp:47:
In file included from /usr/local/include/ql/math/all.hpp:35:
In file included from /usr/local/include/ql/math/matrixutilities/all.hpp:4:
In file included from /usr/local/include/ql/math/matrixutilities/basisincompleteordered.hpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/valarray:4036:46: error: 'value_type' is a private member of
  'boost::iterators::detail::operator_brackets_proxy<QuantLib::step_iterator<double *> >'
           __scalar_expr<typename _Expr::value_type>, _Expr> >
QuantLib/quantlib_wrap.cpp:10789:19: error: no member named 'includeReferenceDateCashFlows' in 'QuantLib::Settings'
        self->includeReferenceDateCashFlows() = b;
        ~~~~  ^
QuantLib/quantlib_wrap.cpp:11175:17: error: no member named 'Surface' in namespace 'QuantLib' using QuantLib::Surface;
  ~~~~~~~~~~^
QuantLib/quantlib_wrap.cpp:11176:17: error: no member named 'Domain' in namespace 'QuantLib' using QuantLib::Domain;
  ~~~~~~~~~~^
QuantLib/quantlib_wrap.cpp:11178:80: error: use of undeclared identifier 'Surface' SWIGINTERN bool boost_shared_ptr_Sl_Surface_Sg____nonzero__(boost::shared_ptr< Surface > *self){
                                                                           ^
QuantLib/quantlib_wrap.cpp:11178:80: error: use of undeclared identifier 'Surface'
QuantLib/quantlib_wrap.cpp:11182:17: error: no member named 'TestSurface' in namespace 'QuantLib' using QuantLib::TestSurface;
  ~~~~~~~~~~^
QuantLib/quantlib_wrap.cpp:11183:27: error: use of undeclared identifier 'Surface'
typedef boost::shared_ptr<Surface> TestSurfacePtr;
                      ^
QuantLib/quantlib_wrap.cpp:11186:43: error: unknown type name 'TestSurface'
        return new TestSurfacePtr(new TestSurface);
                                      ^
QuantLib/quantlib_wrap.cpp:11204:254: error: function definition is not allowed here ...> > const &dates,std::vector< Rate,std::allocator< Rate > > const &yields,DayCounter const &dayCounter,Calendar const &calendar=Calendar(),Linear const &i=Linear()){
                                                                                                                                                                     ^
QuantLib/quantlib_wrap.cpp:11210:100: error: function definition is not allowed here SWIGINTERN std::vector< Date,std::allocator< Date > > const &ZeroCurvePtr_dates(ZeroCurvePtr *self){
                                                                                               ^
QuantLib/quantlib_wrap.cpp:11214:104: error: function definition is not allowed here SWIGINTERN std::vector< Rate,std::allocator< Rate > > const &ZeroCurvePtr_zeroRates(ZeroCurvePtr *self){
                                                                                                   ^
QuantLib/quantlib_wrap.cpp:11218:129: error: function definition is not allowed here SWIGINTERN std::vector< std::pair< Date,Rate >,std::allocator< std::pair< Date,Rate > > > ZeroCurvePtr_nodes(ZeroCurvePtr *self){
                                                                                                                            ^
QuantLib/quantlib_wrap.cpp:11223:8: error: expected unqualified-id extern "C" {
   ^
QuantLib/quantlib_wrap.cpp:196398:8: error: expected unqualified-id extern "C" {
   ^
QuantLib/quantlib_wrap.cpp:196596:8: error: expected unqualified-id extern "C" {
   ^
QuantLib/quantlib_wrap.cpp:196899:8: error: expected unqualified-id extern "C"
4

1 回答 1

0

您可能正在尝试将 QuantLib 1.5 或更高版本与早期版本的 QuantLib-SWIG 一起使用。问题中引用的成员和类在 QuantLib 1.3(我认为)中已弃用,最终在 1.5 版中被删除。QuantLib-SWIG 1.4 或更早版本中定义的接口将尝试找到它们并失败。

您可以通过使用与您正在使用的 QuantLib 版本相匹配的 QuantLib-SWIG 版本来避免错误。

于 2015-09-20T18:43:57.513 回答