I want to use the boost library under windows vs 2015. The installation under windows is not as easy as ubuntu. I saw a blog post that perfectly compiled the 32-bit and 64-bit boost libraries. transfer
Original: https://blog.csdn.net/zengraoli/article/details/70187556
First download the latest version of boost (currently the latest version is 1.63)
Open 32-bit command line tools for vs
Go to the boost source code folder
Go to the boost source code folder
run bootstrap.bat
Do the following to compile boost
( msvc version 14.0 corresponds to vs2015 , --stagedir is the specified directory after compilation, and the article appendix has the corresponding number of the vs version)
- bjam stage --toolset=msvc-14.0 --without-graph --without-graph_parallel --stagedir="D:\boost\boost_1_63_0\bin\vc14" link=static runtime-link=shared runtime-link=static threading=multi debug release
Go to the boost source code folder
run bootstrap.bat
Do the following to compile boost
( msvc version 14.0 corresponds to vs2015 , --stagedir is the directory where it is stored after compilation)
- bjam stage --toolset=msvc-14.0 architecture=x86 address-model=64 --without-graph --without-graph_parallel --stagedir="D:\boost\boost_1_63_0\bin\vc14-x64" link=static runtime-link=shared runtime-link=static threading=multi debug release
This is the 64-bit boot library
Set the test program to 64-bit
Set additional include paths (boost folder unzipped after download):
Set the library path:
Then build the first boost project with the following code:
- #include "boost/thread.hpp"
- #include "iostream"
- usingnamespace std;
- void mythread()
- {
- cout << " hello,thread! " << endl;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- boost::function<void()> f(mythread);
- boost::thread t(f);
- t.join();
- cout << " thread is over! " << endl;
- return 0;
- }