quantlib 1.4 + xcode 4.5.2

4
Quantlib in xcode 4.5.2 Mauricio Bedoya [email protected] 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 find the instructions to installing Quantlib. However I will make a little change: 1. “cd”to the QuantLib directory and type ./configure to configure the package for your system; see the User configuration section for configuration 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 “make”to compile the package (it takes some time). 3. Type “sudo make install”to 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 files in /usr/local/include/ql/. To identify if files where created accordingly, proceed as follow: cmd + shift + G (/usr/local/include/ql). Here you should find all the C++ header files that sup- port 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 fine. If not, proceed with sptep 3. Now open a new project in xcode 4.5.2: (file/new/project/Command Line Tool/any name/any folder/create). Go to: http://quantlib.org/reference/examples.html, and select any example. Copy 1

Upload: mauricio-bedoya

Post on 20-Jan-2016

541 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: QuantLib 1.4 + Xcode 4.5.2

Quantlib in xcode 4.5.2

Mauricio Bedoya

[email protected] 2014

The following procedure works in Mac OS X Lion 10.7.5. I assume that Xcode and Boost arealready installed.

In - http://quantlib.org/reference/install.html- you can find the instructions to installing Quantlib.However I will make a little change:

1. “cd”to the QuantLib directory and type ./configure to configure the package for your system;see the User configuration section for configuration options. ¿ How to ?. If the QuantLibforlder is in Downloads, proceed as follow:

a) Open Terminal (Applications / Utilities / Terminal).

b) Type: cd Download

c) Type: cd Quantlib-1.4.

2. Type “make”to compile the package (it takes some time).

3. Type “sudo make install”to 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 thecorresponding header files in /usr/local/include/ql/.

To identify if files where created accordingly, proceed as follow:cmd + shift + G (/usr/local/include/ql). Here you should find all the C++ header files that sup-port QuanLib functionalities (class, struct, etc).

Next identify if the dynamic and static linkers are created: cmd+shift+G (/usr/local/lib), andsearch for: libQuantLib.a and libQuantLib.dylib. If both appears, everything is working just fine.If not, proceed with sptep 3.

Now open a new project in xcode 4.5.2: (file/new/project/Command Line Tool/any name/anyfolder/create). Go to: http://quantlib.org/reference/examples.html, and select any example. Copy

1

Page 2: QuantLib 1.4 + Xcode 4.5.2

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 andBuild Settings. Here, just make the following changes:

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

2

Page 3: QuantLib 1.4 + Xcode 4.5.2

3

Page 4: QuantLib 1.4 + Xcode 4.5.2

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 definingcontent 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)files.

Now everything should work. Welcome to Quantlib.

4