C++ with Qauntlib

QuantLib is a free/open-source library for modeling, trading, and risk management in quantitative finance. In this below, we will demonstrate how to run an example code in Ubuntu linux. 

First, one shall correctly install

  • c++ compiler: g++
  • boost c++ libraries
  • QauntLib libraries

One can confirm the above installation through following command lines:

$cd /usr/lib

$ls *libboost*

$ls *libQauntLib*

$cd /usr/include

$ls ql

$ls boost


$quantlib-config – -libs – -cflags


Now we can test an example. Download an example code by copy and paste from QuantLib Documentation webpage (here). For instance, the code is saved to a file named “Bonds.cpp”.

Now, we can compile and link by

$g++ -o Bonds Bonds.cpp -L/usr/lib -lQauntLib

Then, run it.


Now you can see pretty cool result for Bonds.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s