You are on page 1of 4

Quantlib in xcode 4.5.

2
Mauricio Bedoya javierma36@hotmail.com February 2014
The following procedure works in Mac OS X Lion 10.7.5. I assume that Xcode and Boost are already installed. In - http://quantlib.org/reference/install.html- you can nd the instructions to installing Quantlib. However I will make a little change: 1. cdto the QuantLib directory and type ./congure to congure the package for your system; see the User conguration section for conguration options. How to ?. If the QuantLib forlder is in Downloads, proceed as follow: a ) Open Terminal (Applications / Utilities / Terminal). b ) Type: cd Download c ) Type: cd Quantlib-1.4. 2. Type maketo compile the package (it takes some time). 3. Type sudo make installto install the library. This might require administrative privileges. This will create dynamic (.dylib) and static (.a) linker to use in xcode 4.5.2. It will also create the corresponding header les in /usr/local/include/ql/. To identify if les where created accordingly, proceed as follow: cmd + shift + G (/usr/local/include/ql). Here you should nd all the C++ header les that support QuanLib functionalities (class, struct, etc). Next identify if the dynamic and static linkers are created: cmd+shift+G (/usr/local/lib), and search for: libQuantLib.a and libQuantLib.dylib. If both appears, everything is working just ne. If not, proceed with sptep 3. Now open a new project in xcode 4.5.2: (le/new/project/Command Line Tool/any name/any folder/create). Go to: http://quantlib.org/reference/examples.html, and select any example. Copy

the content in main.cpp and try to compile. You will get 201 errors . To avoid this: 1. Select the Target, OS X SDK 10.8 (left upper corner in xcode). 2. Next select Targets, Build Phases and Link Binary With Libraries. 3. Click the plus icon, Add items. 4. Go to /usr/local/lib folder (cmd + shift + G). 5. Select libQuantLib.dylib and click Open.

I have a libQuantLib.0.dylib instead of libQuantLib.dylib. Just include one. Now select Target and Build Settings. Here, just make the following changes:

1. In C Language Dialect identify C++ Standard Library: change libc++(LLVC++ standard library with C++11) to libstdc++(GNUC++ standard library).

2. Doble click in Header Search Paths, and include: /usr/local/include/ Here you should have the following folders: boost and ql. If not, make a comment dening content of /usr/local/include 3. Doble click in Library Search Paths, and include: /usr/local/lib/ Here you should have some libboost, libQuantLib and others static (.a) and dynamic (.dylib) les.

Now everything should work. Welcome to Quantlib.

You might also like