How to use C++ Boost library in Visual Studio

By , last updated September 29, 2016

This guide shows how to use Boost library with Visual Studio 2013 or 2015.

There are a couple ways to use Boost with Visual Studio, here are two ways. Property pages and Property sheets.

Property pages

Make sure Configuration is set to All Configurations and Platform is set to All Platforms. If not, you’ll have different settings for Release/Debug and with Win32/x64.

Add the boost_1_61_0 folder to the Additional Include Directories (boost_1_60_0 folder if you are using Boost 1.60). It’s wise to use a path relative to the solution file or project file. The include directory is $(SolutionDir)boost_1_61_0\.


And Additional Include Directories. It’s also wise to have the library directories relative to the solution file or project file. I’m using solution file as reference.

The actual library directory is $(SolutionDir)boost_1_61_0\stage\$(Platform)\lib\ for Boost 1.61 or $(SolutionDir)boost_1_60_0\stage\$(Platform)\lib\ for Boost 1.60.


The macro $(Platform) will expand to either Win32 or x64, which are the same directories the binaries are installed to in the first step.

Property sheet

Say if you have multiple projects, which all use Boost. But due to limited disk space, you want to have one installation of Boost, and not per project. This is the easiest way of doing that, without actually installing it anywhere.

Property sheets are project properties not attached to any specific project, but can be added to multiple projects. Open Property Manager (View -> Property Manager).


Right-click and Add New Project Property Sheet and save it in the same folder as the boost_1_61_0 directory. Not within the boost directory, but next to it.

Read also  Simple bugs - totally wrong behavior

The next step requires some manual editing in the property sheet file, to be able to use the path the property sheet file is in.

Add the following section within the <PropertyGroup Label="UserMacros"> section.


At this point, you’ll have another macro available, which will point to the directory of the property sheet itself. We’ll use this macro to create a path to the directory containing the boost libraries.


Make sure Inherit from parent or project defaults are checked, and press OK to add the path to Additional Include Directories.



The values should read:

  • Additional Include Directories: $(PropSheetPath)boost_1_61_0\;%(AdditionalIncludeDirectories)
  • Additional Library Directories: $(PropSheetPath)boost_1_61_0\stage\$(Platform)\lib\

The complete property sheet file should be like this.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="">
 <ImportGroup Label="PropertySheets" />
 <PropertyGroup Label="UserMacros">
 <PropertyGroup />
 <ItemGroup />

Using the property sheet in your project

The values in the property sheet will not always be used, even though they are configured correctly.


It will be very apparent when errors like “Cannot open include file: boost/something/something.hpp” keeps appearing. You must tell your project to use the inherited values by checking 1 box, Inherit from parent or project defaults. This goes for both include directories and library directories.


For your project, the values should read:

  • Additional Include Directories: %(AdditionalIncludeDirectories)
  • Additional Library Directories: %(AdditionalLibraryDirectories)

See the difference between Library and Include.

When all is set, you can build many projects from the same boost source files using the same property sheet from all project.

Now it’s time to write some Boost examples.


  1. Akshay Raj Gollahalli October 13, 2016 Leave a Reply


    I don’t think PropSheetPath is supported anymore in the latest updated of VS 2015. Any alternate to it?

    • Kent Fagerjord October 16, 2016 Leave a Reply

      Hi Akshay.

      I’m using VS2015 update 3 daily, and my projects use such properties as $(PropSheetPath) daily. Remember you have to edit the property sheet manually to insert that property. There is no way of doing so through Visual Studio.


Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>