您的位置:首页 > 其它

boost_1_66_0 VS2015编译安装

2018-02-11 10:25 453 查看

1. 下载boost库

  boost库是一个应用广泛的开源库,我们可以到boost官网上下载我们需要的boost库版本。博主这里使用的是boost_1_66_0.由于这里我们是在VS2015上编译安装,因此我们下载是的Window版本的boost库。下载完成后,只需要解压到指定目录即可(这个目录可自行选择)。



2. 编译boost库

2.1 运行bootstra.bat 生成bjam.exe编译工具

  首先,以管理员的权限运行vs2015命令行工具(如果是32位的系统选择x86,如果是64位的系统选择x64)。



  然后,进入到我们解压后的boost库目录。



  最后,运行bootstrap.bat。



2.2 使用bjam编译boost库

  编译生成静态库:
  bjam install stage --toolset=msvc-14.0 --stagedir="E:\BoostLib\boost_1_66_0" link=static runtime-link=static threading=multi address-model=64 debug release

  编译生成动态库:
  bjam install stage --toolset=msvc-14.0 --stagedir="E:\BoostLib\boost_1_66_0" link=static runtime-link=shared threading=multi address-model=64 debug release

  最后,生成的库文件如下所示:



2.3 VS2015配置





  这里我的boost目录是:C:\Boost。系统是64位。

3. 测试用例

/*********************************************************************************
*Copyright(C),Your Company
*FileName:  main.cpp
*Author:  Huangjh
*Version:
*Date:  2018-02-11
*Description:  boost编译完成后的测试用例
*Others:
**********************************************************************************/
#include <iostream>
#include <cstdlib>
#include <boost/thread.hpp>

using namespace std;
using namespace boost;

void threadFunction(void)
{
cout << "threadFunction running ..." << endl;
}

int main(void)
{
cout << "boost thread test start ..." << endl;

thread myThread(threadFunction);

myThread.join();

::system("pause ");

return 0;
}
  运行结果如下所示:
boost thread test start ...
threadFunction running ...
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  visual studio 64位 boost