Archivos Mensuales: noviembre 2012

Installing QuantLib for VC11 (Windows)

Below are instructions for installing and using QuantLib 1.2 for VC11 on a computer running under Windows (32-bit). We will only install  the core library of QuantLib, that is only 1 of the 15 projects contained in the solution file. Thus, we will just need Boost header-only. There will no need to install the Boost library.

(I) Requirements

a) You must have the VC11 environment available on your computer, that is Visual Studio 11 Beta, Visual Studio 2012, Visual C++ 2012 Express, … .

b) The Boost library can be downloaded here. Currently, the latest version available is Boost 1.52.0.

c) The QuantLib library. The solution file of QuantLib 1.2.1 for VC11 can be downloaded from a previous post.

(II) Building QuantLib

We will build the solution from within Visual Studio in Debug mode, here. Just follow the same upcoming installation steps to build QuantLib in any other mode (e.g. in Release mode). From now onwards, we assume everything is okay with the requirements in (I).

a) From within your GUI or directly by double clicking on the file, open the solution file named QuantLib_vc11.sln ( … \QuantLib-1.2.1\ QuantLib_vc11.sln). This will open the 15 projects contained in the solution (see the picture, below).

b) Make sure the ‘QuantLib’ project is selected that is it is enlighten in the ‘Solution Explorer’ panel. Then, right-click and select ‘Properties’ in the context menu.

c) Add the path to the folder … \boost_1_52 to Configuration Properties/VC++ Directories/Include Directories. Then, add the path to the folder … \boost_1_52\libs to Configuration Properties/VC++ Directories/Libraries Directories (see in bold on the picture, below). Obviously, you click on ‘Apply’ for your changes to be taken into account.

d) Now, in the ‘QuantLib Properties Pages’ panel, set the Configuration Properties/C/C++/Precompiled Headers/Precompiled Header item to ‘Not Using Precompiled Headers’.

f) In the ‘Solution Explorer’ panel, right-click on ‘Solution_vc11’ (15 projects)’ and select ‘Properties’. In Configuration Properties/Configuration unselect all the project from ‘Build’ except the ‘QuantLib’ project.

g) Now, right-click again on ‘Solution_vc11’ (15 projects)’ in the ‘Solution Explorer’ panel and click on ‘Build Solution’. Alternatively, on can strike the F7 key. The build process should start.

There might be warning messages during the compilation, but this is no real problem.

(III) QuantLib Usage

a) Each time the C++ program you write relies on the QuantLib library, you will have to make the … \boost_1_52 and … \boost_1_52\libs folders visible to your project as shown at the step (II,c), above.

b) Then, add the path to the folder … /QuantLib-1.2.1 to Configuration Properties/C/C++/General/Additional Include Directories.

c) Eventually, add the path to the folder … /QuantLib-1.2.1/lib to Configuration Properties/Librarian/General.

Alternatively, one can make the steps (III, a) an (III, b) less tiredsome, specifying once for all the directories required for the use of QuantLib, e.g. by specifying a per-user directory list, or any other method you like*.

* Thank you to Polter  for his comments in the Wilmott forums.