2

I've been trying to run some of the example code (BermudanSwaption) in Xcode but keep getting an EXC_BAD_ACCESS code=2.

But compiling and running the BermudanSwaption code in the terminal works correctly.

The following code throws the same error in 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?

Kaush
  • 41
  • 3
  • I have the same problem, have you solved it – darcyy Mar 31 '14 at 14:58
  • I found that #including the individual libraries separately rather then including ql/quanlib to work. So in my example sub ql/quantlib.hpp with ql/time/date.hpp and everything runs fine. – Kaush Apr 01 '14 at 15:33
  • Nice, it works for me too! Please add that to the answer – darcyy Apr 06 '14 at 09:40

2 Answers2

2

I found that #including the individual libraries separately rather then including ql/quanlib to work. So in my example sub ql/quantlib.hpp with ql/time/date.hpp and everything runs fine.

Kaush
  • 41
  • 3
1

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:

In <ql/experimental/models/all.hpp>, comment out these lines:

#include <ql/experimental/models/kahalesmilesection.hpp>
#include <ql/experimental/models/markovfunctional.hpp>
Bubz0
  • 392
  • 2
  • 10