代码
#include <ql/quantlib.hpp>
#include <boost/timer.hpp>
int main ()
{
return 0;
}
库安装
sudo apt-get install libquantlib-1.1
QuantLib 配置
$quantlib-config --libs
-L/usr/lib -lQuantLib
$ quantlib-config --cflags
-I/usr/include
$
编译和链接步骤:
$ g++ test1.cpp -L/usr/lib -lQuantLib -I/usr/include -fPIC -o test1 /tmp/cc0GDoC4.o:在函数“QuantLib::CPICoupon::indexFixing() const”中: test1.cpp:(.text._ZNK8QuantLib9CPICoupon11indexFixingEv[QuantLib::CPICoupon::indexFixing() const]+0x36): 未定义引用 `QuantLib::CPICoupon::indexFixing(QuantLib::Date const&) const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib22SwaptionVolatilityCubeE[vtable for QuantLib::SwaptionVolatilityCube]+0x100): 未定义对“到 QuantLib::SwaptionVolatilityDiscrete::update() 的非虚拟 thunk 的引用” /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib22SwaptionVolatilityCubeE0_NS_26SwaptionVolatilityDiscreteE[用于 QuantLib::SwaptionVolatilityCube 的 vtable]+0xa8):未定义对“到 QuantLib::SwaptionVolatilityDiscrete::update() 的非虚拟 thunk 的引用” /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib22CapFloorTermVolSurfaceE[用于 QuantLib::CapFloorTermVolSurface 的 vtable]+0xc8):未定义对“到 QuantLib::CapFloorTermVolSurface::update() 的非虚拟 thunk 的引用” /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib20CapFloorTermVolCurveE[用于 QuantLib::CapFloorTermVolCurve 的 vtable]+0xc8):未定义对“到 QuantLib::CapFloorTermVolCurve::update() 的非虚拟 thunk”的引用 /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib20SpreadedSmileSectionE[vtable for QuantLib::SpreadedSmileSection]+0x50):未定义对 `QuantLib::SmileSection::optionPrice(double, QuantLib::Option::Type,双)常量' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib20SpreadedSmileSectionE[vtable for QuantLib::SpreadedSmileSection]+0x58):未定义对 `QuantLib::SmileSection::digitalOptionPrice(double, QuantLib::Option::Type,双,双)常量' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib20SpreadedSmileSectionE[vtable for QuantLib::SpreadedSmileSection]+0x60): 未定义引用 `QuantLib::SmileSection::vega(double, double) const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib20SpreadedSmileSectionE[vtable for QuantLib::SpreadedSmileSection]+0x68): 未定义引用 `QuantLib::SmileSection::density(double, double, double) const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib20SpreadedSmileSectionE0_NS_12SmileSectionE[用于 QuantLib::SpreadedSmileSection 的 vtable]+0x50):未定义对 `QuantLib::SmileSection::optionPrice(double, QuantLib::Option::Type,双)常量' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib20SpreadedSmileSectionE0_NS_12SmileSectionE[用于 QuantLib::SpreadedSmileSection 的 vtable]+0x58): 未定义引用 `QuantLib::SmileSection::digitalOptionPrice(double, QuantLib::Option::Type,双,双)常量' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib20SpreadedSmileSectionE0_NS_12SmileSectionE[vtable for QuantLib::SpreadedSmileSection]+0x60): 未定义对 `QuantLib::SmileSection::vega(double, double) const' 的引用 /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib20SpreadedSmileSectionE0_NS_12SmileSectionE[用于 QuantLib::SpreadedSmileSection 的 vtable]+0x68):未定义引用 `QuantLib::SmileSection::density(double, double, double) const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib10FdmBatesOpE[用于 QuantLib::FdmBatesOp 的 vtable]+0x60): 未定义引用 `QuantLib::FdmBatesOp::toMatrixDecomp() const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib16FlatSmileSectionE[vtable for QuantLib::FlatSmileSection]+0x50):未定义对 `QuantLib::SmileSection::optionPrice(double, QuantLib::Option::Type,双)常量' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib16FlatSmileSectionE[vtable for QuantLib::FlatSmileSection]+0x58): 未定义对 `QuantLib::SmileSection::digitalOptionPrice(double, QuantLib::Option::Type,双,双)常量' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib16FlatSmileSectionE[vtable for QuantLib::FlatSmileSection]+0x60): 未定义引用 `QuantLib::SmileSection::vega(double, double) const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib16FlatSmileSectionE[vtable for QuantLib::FlatSmileSection]+0x68): 未定义引用 `QuantLib::SmileSection::density(double, double, double) const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib16FlatSmileSectionE0_NS_12SmileSectionE[用于 QuantLib::FlatSmileSection 的 vtable]+0x50):未定义对 `QuantLib::SmileSection::optionPrice(double, QuantLib::Option::Type,双)常量' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib16FlatSmileSectionE0_NS_12SmileSectionE[用于 QuantLib::FlatSmileSection 的 vtable]+0x58): 未定义对 `QuantLib::SmileSection::digitalOptionPrice(double, QuantLib::Option::Type,双,双)常量' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib16FlatSmileSectionE0_NS_12SmileSectionE[vtable for QuantLib::FlatSmileSection]+0x60): 未定义引用 `QuantLib::SmileSection::vega(double, double) const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTCN8QuantLib16FlatSmileSectionE0_NS_12SmileSectionE[vtable for QuantLib::FlatSmileSection]+0x68): 未定义引用 `QuantLib::SmileSection::density(double, double, double) const' /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib27CPICapFloorTermPriceSurfaceE[vtable for QuantLib::CPICapFloorTermPriceSurface]+0xb0): 未定义对 `QuantLib::CPICapFloorTermPriceSurface::price(QuantLib::Period const&, double) const' 的引用 /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib27CPICapFloorTermPriceSurfaceE[vtable for QuantLib::CPICapFloorTermPriceSurface]+0xb8): 未定义对 `QuantLib::CPICapFloorTermPriceSurface::capPrice(QuantLib::Period const&, double) const' 的引用 /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib27CPICapFloorTermPriceSurfaceE[vtable for QuantLib::CPICapFloorTermPriceSurface]+0xc0): 未定义对 `QuantLib::CPICapFloorTermPriceSurface::floorPrice(QuantLib::Period const&, double) const' 的引用 /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib27CPICapFloorTermPriceSurfaceE[用于 QuantLib::CPICapFloorTermPriceSurface 的 vtable]+0x128):未定义对“QuantLib::CPICapFloorTermPriceSurface::cpiOptionDateFromTenor(QuantLib::Period const&) const”的引用 /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib9CPICouponE[QuantLib::CPICoupon 的 vtable]+0x30):未定义对 `QuantLib::CPICoupon::accept(QuantLib::AcyclicVisitor&)' 的引用 /tmp/cc0GDoC4.o:(.data.rel.ro._ZTVN8QuantLib9CPICouponE[用于 QuantLib::CPICoupon 的 vtable]+0x78):未定义对 `QuantLib::CPICoupon::checkPricerImpl(boost::shared_ptr const&) const' 的引用 collect2: ld 返回 1 个退出状态
请你帮助我好吗 ?