这可能不是一个棘手的问题,我是一个C++新手。
我正在尝试在cling REPL中使用一个名为QuantLib的库。
我可以通过执行以下操作在GCC中加载库
#include "ql/quantlib.hpp"然后用-lQuantLib编译。
在cling中,我尝试了以下3行的排列:
.I "ql/quantlib.hpp"
#include "ql/quantlib.hpp"
.L QuantLib如果我首先运行#include,我会得到一个很长的错误,包括如下内容
You are probably missing the definition of
QuantLib::AbcdAtmVolCurve::accept(QuantLib::AcyclicVisitor&) Maybe you
need to load the corresponding shared library?但如果我参选
.I "ql/quantlib.hpp"
#include "ql/quantlib.hpp"然后一切看起来都很好。
.L Quantlib结果为
input_line_4:1:10: fatal error: 'QuantLib' file not found
#include "QuantLib"不管它什么时候运行。
在kfsone的评论之后,我尝试了以下内容
.L /usr/lib/libQuantLib.so
#include "ql/quantlib.hpp"这会给出一个简短的错误!
IncrementalExecutor::executeFunction: symbol '_ZN8QuantLib5ErrorC1ERKSslS2_S2_' unresolved while linking function '__cxx_global_var_init34'!
You are probably missing the definition of QuantLib::Error::Error(std::string const&, long, std::string const&, std::string const&)
Maybe you need to load the corresponding shared library?发布于 2018-05-11 19:51:33
Cling需要知道要使用的结构/函数的语法,并拥有执行的二进制代码。
对于语法,您必须添加include,例如:
#include "myfile.hpp"对于二进制代码,您必须像这样装入库:
#pragma cling load("myfile.so.9.220.0")https://stackoverflow.com/questions/37671030
复制相似问题