pBook‎ > ‎BOOST C++‎ > ‎

Boost Building VStudio

posted Oct 22, 2014, 7:44 AM by Javad Taghia   [ updated Oct 22, 2014, 8:24 AM ]
1. Download Boost from Boost.org. I've included 1.56.0 version link here as well.

The zip folder is about 150M and after extraction will be about 450M. 

2. Put it preferably in C:\Boost\1.56.0\vc\12 folder ; so create a path to do so. It's good to have such path to make it easier when we reference to it.
3. in Developer Command Prompt Visual Studio of your choice, here VS2012CMD; go to the C:\Boost\1.56.0\vc\12 and write:
you will see a message.
4. Then write this command:
b2 --toolset=msvc-11.0 --build-type=complete stage
It takes a while to build the whole library for you. Then you have the boost ready to use.
5. Now to test it go to: C:\Boost\1.56.0\vc\12\more\getting_started\windows.html
In this document there is an example to test our working boost lib as:

#include <boost/regex.hpp>
#include <iostream>
#include <string>

int main()
    std::string line;
    boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );

    while (std::cin)
        std::getline(std::cin, line);
        boost::smatch matches;
        if (boost::regex_match(line, matches, pat))
            std::cout << matches[2] << std::endl;

6. Now create an empty new project and in the properties go to VC++ Directories and 
Add C:\Boost\1.56.0\vc\12 to Include and C:\Boost\1.56.0\vc\12\stage\lib to the Library one and you are done. Compile and enjoy.
Look at this youtube video too: https://www.youtube.com/watch?v=6trC5zVXzG0