vc11+
2024-11-19
Written by: tdtc
support of MSVC
名称 | VS版本 | Minimum version |
---|---|---|
msvc-11.0 | VS2012 | 1.52.0 |
msvc-12.0 | VS2013 | 1.55.0 |
msvc-14.0 | VS2015 | 1.59.0 |
msvc-14.1 | VS2017 | 1.64.0 |
msvc-14.2 | VS2019 | 1.71.0 |
msvc-14.3 | VS2022 | 1.78.0 |
Current Version(xyz): 1.86.0
x86 Native Tools Command Prompt for VS xxxx
as of Boost 1.47.0, the official name of the executable was changed to b2.
cd C:\boost_x_y_z
bootstrap.bat
b2 stage --toolset=msvc-14.3 --without-graph --without-graph_parallel --without-math --without-mpi --without-python --without-serialization --without-wave --stagedir="C:\boost\bin\vc143" link=static runtime-link=shared runtime-link=static threading=multi debug release
b2 stage --toolset=msvc-14.2
...
--stagedir="C:\boost\bin\vc142"
...
Copy the ‘C:\boost_x_y_z\boost’ folder to ‘C:’ disk
Project->Properties->Configuration Properties
VC++ Directories->General
Linker->General
vs2017/vs2019
#include <boost/thread.hpp>
#include <boost/chrono.hpp>
#include <iostream>
void wait(int seconds)
{
boost::this_thread::sleep_for(boost::chrono::seconds{ seconds });
}
void thread()
{
for (int i = 0; i < 5; ++i)
{
wait(1);
std::cout << i << std::endl;
}
}
int main()
{
boost::thread t{ thread };
t.join();
}
The top of the reference header add:
#include "stdafx.h"