source URL: http://stackoverflow.com/questions/2629421/how-to-use-boost-in-visual-studio-2010
While the instructions on the Boost web site are helpful, here is a condensed version that also builds x64 libraries.
Build the 32-bit librariesThis installs the Boost header files under , and the 32-bit libraries under . Note that the default location for the libraries is but you’ll want to put them under an directory if you plan to build for multiple architectures.
Build the 64-bit librariesThis installs the Boost header files under , and the 64-bit libraries under . Note that the default location for the libraries is but you’ll want to put them under an directory if you plan to build for multiple architectures.
|
Test code
// boost_lib.cpp : 定義控制台應用程式的入口點。
//
#include "stdafx.h"
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/regex.hpp>
#include <boost/thread/thread.hpp>
using namespace std;
void wait(int seconds)
{
boost::this_thread::sleep(boost::posix_time::seconds(seconds));
}
void my_thread()
{
for (int i = 0; i < 5; ++i)
{
wait(1);
std::cout << i << std::endl;
}
}
int main()
{
boost::thread t(my_thread);
t.join();
}