Friday, February 26, 2016

Compiling and configuring boost c++ libraries v1.60 for visual studio 2013

Download boost library v1.60:

Extract zip file to C:\boost\MSVS\1.60

Set environment BOOST_ROOT to C:\boost\MSVS\1.60

Build Project 1:
  • 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
  • In the name field, enter "example"
  • Right-click example project 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:\boost\MSVS\1.60
  • In Configuration Properties > C/C++ > Precompiled Headers, change Use Precompiled Header (/Yu) to Not Using Precompiled Headers.
  • Replace the contents of the example.cpp generated by the IDE with the following code.
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

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

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
  • From the Build menu, select Build Solution.

Compiling Boost library

bootstrap
.\b2

Link Your Program to a Boost Library

  1. Right-click example in the Solution Explorer pane and select Properties from the resulting pop-up menu
  2. In Configuration Properties > VC++ Directories > Library Directories, enter the path to the Boost binaries, e.g. C:\boost\MSVS\1.60\stage\lib.

  1. From the Build menu, select Build Solution.


http://www.boost.org/doc/libs/1_60_0/more/getting_started/windows.html

No comments:

Post a Comment