[英]C++ Quantlib EXC_BAD_ACCESS in Xcode
I've been trying to run some of the example code (BermudanSwaption) in Xcode but keep getting an EXC_BAD_ACCESS code=2. 我一直在尝试在Xcode中运行一些示例代码(BermudanSwaption),但始终获得EXC_BAD_ACCESS代码= 2。
But compiling and running the BermudanSwaption code in the terminal works correctly. 但是在终端中编译并运行BermudanSwaption代码可以正常工作。
The following code throws the same error in Xcode. 以下代码在Xcode中引发相同的错误。
#include <ql/quantlib.hpp>
#include <iostream>
using namespace QuantLib;
int main (){
Date date(18, March, 2014);
std::cout << date << std::endl;
}
And this runs correctly. 这可以正常运行。
g++ -I/opt/local/include/ -I/opt/local/include/boost main.cpp -o main -L/opt/local/lib/ -lQuantLib
Are there some specific settings I need to tweak in Xcode in order for this to run? 我需要在Xcode中进行一些调整以使其运行吗?
I found that #including the individual libraries separately rather then including ql/quanlib to work. 我发现#单独包含各个库,而不包含ql / quanlib才能正常工作。 So in my example sub ql/quantlib.hpp with ql/time/date.hpp and everything runs fine.
因此,在我的示例中,使用ql / time / date.hpp的子ql / quantlib.hpp可以正常运行。
Following the suggestion of Kaush, and a bit of trial and error, the following works for me in QuantLib 1.4, and means you don't have to add in every single individual library: 遵循Kaush的建议以及一些试验和错误之后,以下内容在QuantLib 1.4中对我有用,这意味着您不必添加每个单独的库:
In <ql/experimental/models/all.hpp>
, comment out these lines: 在
<ql/experimental/models/all.hpp>
,注释掉以下<ql/experimental/models/all.hpp>
行:
#include <ql/experimental/models/kahalesmilesection.hpp>
#include <ql/experimental/models/markovfunctional.hpp>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.