# Tutorial: QuantLib Boost Installation in Visual Studio 2012

#### Felix Kotey

##### Active Member
C++ Student
1. These are step-by-step instructions to install QuantLib and Boost on the Microsoft Visual C++ 2012 IDE
2. These instructions are for MS Visual C++ 2012 only. If you have earlier versions of this IDE (2008, 2005...) then have a look at this page.
3. Before using QuantLib you need to install the Boost library on your computer. Iinstructions om how to get Boost library follow in the next section.
Boost Installation
2. You can build boost by following the instruction here.
3. Alternative you can download a pre-built lib from here. Once downloaded, copy the installer into the Boost 1.52.0 folder and run it. Rename the folder to lib once done.
Boost and QuantLib Installation
1. Download QuantLib 1.2.1 compatible with VS 2012 from this page. With Boost 1.52.0 and QuantLib 1.2.1 installed , you can set the VC++ directories as follows.
2. 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).
3. Open the Property Manager window, (see View menu, Other Windows, Property Manager), locate the Microsoft.Cpp.Win32.user property sheet.
4. Select Microsoft.Cpp.Win32.user property sheet as shown above, right click it and select Properties.
5. Add the folder … \boost_1_52 to Configuration Properties/VC++ Directories/Include Directories. Then, add the path to the folder … \boost_1_52\lib to Configuration Properties/VC++ Directories/Libraries Directories (see picture below).
6. Click ok to apply changes.
7. Switch back to the Solutions Explorer, right-click on the solution icon and choose Build Solution to build all projects in the Release mode. Besides QuantLib, this will build the examples and run the test suite.
8. After finishing, the output should show no errors and look like below:
9. You are done with building QuantLib. If you want, you can build the Debug version in the same way by choosing Debug from the configuration menu as shown below. This will allow you to debug your application later.

10. To test QuantLib with the example here, go to VC++ Directories. You can see that the Boost folders are already there, so you don't have to do anything to configure them. Add the QuantLib path (….\QuantLib) to the include directories.
11. Finally, you can add the QuantLib library path (….\QuantLib\lib) to the library directories, or you can go to Configuration Properties/Linker/Generaland add it to Additional Library Directories. Click OK.
12. For more information refer to this link where I got most of the information for this tutorial -- Quantcorner.

#### tagoma

##### Member
For more information refer to this link where I got most of the information for this tutorial -- Quantcorner.
An excellent online resource, I presume
Anyway, thank you for mentionning my blog site.
I have not been notified of your link to my blog by wordpress. Strange!

C++ Student

#### tagoma

##### Member
Thanks!!!! Actually, I found you blog just a moment ago. So, I deleted my post and now am installing with vc11. Thank you very much!
You're welcome. Enjoy QL

#### Haomiao Zhai

##### Member
C++ Student
You're welcome. Enjoy QL
Hi, there still are some errors:

1> QuantLib_vc11.vcxproj -> C:\QuantLib-1.2.1\QuantLib-1.2.1\.\lib\QuantLib-vc110-mt.lib
2>------ Skipped Rebuild All: Project: testsuite, Configuration: Release Win32 ------
2>Project not selected to build for this solution configuration
3>------ Skipped Rebuild All: Project: Swap, Configuration: Release Win32 ------
3>Project not selected to build for this solution configuration
4>------ Skipped Rebuild All: Project: EquityOption, Configuration: Release Win32 ------
4>Project not selected to build for this solution configuration
5>------ Skipped Rebuild All: Project: ConvertibleBonds, Configuration: Release Win32 ------
5>Project not selected to build for this solution configuration
6>------ Skipped Rebuild All: Project: FRA, Configuration: Release Win32 ------
6>Project not selected to build for this solution configuration
7>------ Skipped Rebuild All: Project: Repo, Configuration: Release Win32 ------
7>Project not selected to build for this solution configuration
8>------ Skipped Rebuild All: Project: Replication, Configuration: Release Win32 ------
8>Project not selected to build for this solution configuration
9>------ Skipped Rebuild All: Project: BermudanSwaption, Configuration: Release Win32 ------
9>Project not selected to build for this solution configuration
10>------ Skipped Rebuild All: Project: DiscreteHedging, Configuration: Release Win32 ------
10>Project not selected to build for this solution configuration
11>------ Skipped Rebuild All: Project: FittedBondCurve, Configuration: Release Win32 ------
11>Project not selected to build for this solution configuration
12>------ Skipped Rebuild All: Project: CallableBonds, Configuration: Release Win32 ------
12>Project not selected to build for this solution configuration
13>------ Skipped Rebuild All: Project: CDS, Configuration: Release Win32 ------
13>Project not selected to build for this solution configuration
14>------ Skipped Rebuild All: Project: Bonds, Configuration: Release Win32 ------
14>Project not selected to build for this solution configuration
15>------ Skipped Rebuild All: Project: MarketModels, Configuration: Release Win32 ------
15>Project not selected to build for this solution configuration
========== Rebuild All: 1 succeeded, 0 failed, 14 skipped ==========

Could you help me? Thanks a lot!!!

#### tagoma

##### Member
Hi, there still are some errors:

1> QuantLib_vc11.vcxproj -> C:\QuantLib-1.2.1\QuantLib-1.2.1\.\lib\QuantLib-vc110-mt.lib
2>------ Skipped Rebuild All: Project: testsuite, Configuration: Release Win32 ------
2>Project not selected to build for this solution configuration
3>------ Skipped Rebuild All: Project: Swap, Configuration: Release Win32 ------
3>Project not selected to build for this solution configuration
4>------ Skipped Rebuild All: Project: EquityOption, Configuration: Release Win32 ------
4>Project not selected to build for this solution configuration
5>------ Skipped Rebuild All: Project: ConvertibleBonds, Configuration: Release Win32 ------
5>Project not selected to build for this solution configuration
6>------ Skipped Rebuild All: Project: FRA, Configuration: Release Win32 ------
6>Project not selected to build for this solution configuration
7>------ Skipped Rebuild All: Project: Repo, Configuration: Release Win32 ------
7>Project not selected to build for this solution configuration
8>------ Skipped Rebuild All: Project: Replication, Configuration: Release Win32 ------
8>Project not selected to build for this solution configuration
9>------ Skipped Rebuild All: Project: BermudanSwaption, Configuration: Release Win32 ------
9>Project not selected to build for this solution configuration
10>------ Skipped Rebuild All: Project: DiscreteHedging, Configuration: Release Win32 ------
10>Project not selected to build for this solution configuration
11>------ Skipped Rebuild All: Project: FittedBondCurve, Configuration: Release Win32 ------
11>Project not selected to build for this solution configuration
12>------ Skipped Rebuild All: Project: CallableBonds, Configuration: Release Win32 ------
12>Project not selected to build for this solution configuration
13>------ Skipped Rebuild All: Project: CDS, Configuration: Release Win32 ------
13>Project not selected to build for this solution configuration
14>------ Skipped Rebuild All: Project: Bonds, Configuration: Release Win32 ------
14>Project not selected to build for this solution configuration
15>------ Skipped Rebuild All: Project: MarketModels, Configuration: Release Win32 ------
15>Project not selected to build for this solution configuration
========== Rebuild All: 1 succeeded, 0 failed, 14 skipped ==========

Could you help me? Thanks a lot!!!

Hi again.

Well, I don't think there is any problem here. You compiler just recalls that 14 projects were skipped while the solution was built.

If you followed the steps from my blog, you must have unselected these 14 projects:

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.

(The reason for unselected is that boost is not installed -- there, in the case of my blog -- , but QL installation relies on boost header files only.)

The 'core' of QL is now installed on your computer. And you can start to write your pieces of code. Some example projects, the test-suite and other things are not installed .... but there are not compulsory.

If you want to check that works:
You can go to this page, create a new project in VS, make sure the QL files are visible to your compiler, paste the (ugly) snippet I wrote, and build the project.

HTH
Edouard

#### Haomiao Zhai

##### Member
C++ Student
Hi again.

Well, I don't think there is any problem here. You compiler just recalls that 14 projects were skipped while the solution was built.

If you followed the steps from my blog, you must have unselected these 14 projects:

(The reason for unselected is that boost is not installed -- there, in the case of my blog -- , but QL installation relies on boost header files only.)

The 'core' of QL is now installed on your computer. And you can start to write your pieces of code. Some example projects, the test-suite and other things are not installed .... but there are not compulsory.

If you want to check that works:
You can go to this page, create a new project in VS, make sure the QL files are visible to your compiler, paste the (ugly) snippet I wrote, and build the project.

HTH
Edouard
Hi,

I follow your blog step by step to build Quantlib_vc11. But, now, when I try your sample code, it says "fatel error C1083: Cannot open include file: 'q1/quantlib.hpp': No such file or directory".

It is so weird. I checked my VC++ Directories and C/C++ General, however, I do not have librarian after C/C++, Linker instead of. So, I cannot finish "Eventually, add the path to the folder … /QuantLib-1.2.1/lib to Configuration Properties/Librarian/General.".

#### Haomiao Zhai

##### Member
C++ Student
Hi again.

Well, I don't think there is any problem here. You compiler just recalls that 14 projects were skipped while the solution was built.

If you followed the steps from my blog, you must have unselected these 14 projects:

(The reason for unselected is that boost is not installed -- there, in the case of my blog -- , but QL installation relies on boost header files only.)

The 'core' of QL is now installed on your computer. And you can start to write your pieces of code. Some example projects, the test-suite and other things are not installed .... but there are not compulsory.

If you want to check that works:
You can go to this page, create a new project in VS, make sure the QL files are visible to your compiler, paste the (ugly) snippet I wrote, and build the project.

HTH
Edouard
Hi,

I followed this:

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.

And add the … /QuantLib-1.2.1/lib into the additional Library directories. Now, it could find the header file. But, the new error is:

cannot open file 'QuantLib-vc110-mt-gb.lib'.

#### Attachments

• 222.7 KB Views: 80

#### tagoma

##### Member
Hi,

I followed this:

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.

And add the … /QuantLib-1.2.1/lib into the additional Library directories. Now, it could find the header file. But, the new error is:

cannot open file 'QuantLib-vc110-mt-gb.lib'.

I think the problem is that you build the project (the matrix thing) in say 'release' mode while you built QL in say 'debug' mode (or the other way around).

At the beginning of my post, I wrote:
We will build the solution from within Visual Studio in Debug mode, here.
Did you pay attention to that?

I'm not an expert in compilers/compilation, but I think -mt-gb (in QuantLib-vc110-mt-gb.lib) tells that (in this case QL) was built in debug mode while -mt implies that it was built in release mode (maybe I'm wrong and this is the other way around).

Just make sure the matrix project (and any other projects with QL from now) is built in the same mode as QL on your computer.

Building QL in both release and debug mode is a good idea.

HTH
Edouard

#### tagoma

##### Member
In the message you wrote above, the error messages following the building of QL on your computer was (excerpt):
------ Skipped Rebuild All: Project: testsuite, Configuration: Release Win32 --
It clearly says that you built QL in release mode.
Did you try to build the matrix project in (the same mode that is) release mode?

#### Haomiao Zhai

##### Member
C++ Student
In the message you wrote above, the error messages following the building of QL on your computer was (excerpt):

It clearly says that you built QL in release mode.
Did you try to build the matrix project in (the same mode that is) release mode?

Dear Edouard,

It works now!!! Thank you very very much!

#### tagoma

##### Member
Dear Edouard,

It works now!!! Thank you very very much!
Good! Have a good end of your week-end

#### lulumink

##### New Member
Hey guys,

I still have this problem. I tried both RELEASE and DEBUG. What is the problem? Something wrong with the Boost lib?

1>------ Build started: Project: testsuite, Configuration: Debug Win32 ------
1>americanoption.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification
1>LINK : fatal error LNK1104: cannot open file 'libboost_unit_test_framework-vc110-mt-gd-1_52.lib'
========== Build: 0 succeeded, 1 failed, 14 up-to-date, 0 skipped ==========

#### lulumink

##### New Member
I've included an error message window from VS2012.
Please have a look, no matter what I do I get this.

Thanks.

#### Attachments

• 82 KB Views: 101

#### ExSan

##### Active Member
can some one please point a link to install boost in eclipse (Ubuntu) ?

#### alain

##### Older and Wiser
can some one please point a link to install boost in eclipse (Ubuntu) ?
Code:
\$ sudo apt-get -y install libboost-all-dev

#### ExSan

##### Active Member
thanks a lot Alain

#### lulumink

##### New Member
Someone has an idea about my issue?!

#### lulumink

##### New Member
Problem solved by myself. Thanks anyway.