Home / Language / English / Install Boost and C++

Install Boost and C++

Getting Started with Visual Studio

Install and Setup Boost:’

Get Boost

The easiest way to get a copy of Boost is to use an installer. The Boost website version of this Getting Started guide will have undated information on installers as they become available, or see Boost downloads or the installer provided by BoostPro Computing. We especially recommend using an installer if you use Microsoft Visual Studio, because the installer can download and install precompiled library binaries, saving you the trouble of building them yourself. To complete this tutorial, you’ll need to at least install the Static Multithreaded variants of the Boost.Regex binaries when given the option.

If you’re using an earlier version of Visual Studio or some other compiler, or if you prefer to build everything yourself, you can download boost_1_41_0.7z or boost_1_41_0.zip and unpack it to install a complete Boost distribution

Build From the Visual Studio IDE

  • From Visual Studio’s File menu, select New > Project…

  • In the left-hand pane of the resulting New Project dialog, select Visual C++ > Win32.

  • In the right-hand pane, select Win32 Console Application (VS8.0) or Win32 Console Project (VS7.1).

  • In the name field, enter “example”

  • Right-click example in the Solution Explorer pane and select Properties from the resulting pop-up menu

  • In Configuration Properties > C/C++ > General > Additional Include Directories, enter the path to the Boost root directory, for example

    C:Program Filesboostboost_1_41_0

  • In Configuration Properties > C/C++ > Precompiled Headers, change Use Precompiled Header (/Yu) to Not Using Precompiled Headers.3

  • Replace the contents of the example.cpp generated by the IDE with the example code below

    #include <boost/lambda/lambda.hpp>
    #include <iostream>
    #include <iterator>
    #include <algorithm>

    int main()
        using namespace boost::lambda;
        typedef std::istream_iterator<int> in;

            in(std::cin), in(), std::cout << (_1 * 3) << ” ” );

  • From the Build menu, select Build Solution.


About Mohammad Khazab

%d bloggers like this: