由于用到相机同步,就安装了boost库 下面说一下安装方法:
1、下载boost官网安装包。
https://dl.bintray.com/boostorg/release/1.66.0/binaries/
注意:这里一定要选择好boost版本
如: boost_1_66_0-msvc-14.0-64.exe 14.0对应vs2015 64:64位
2、下载后解压。
3、找到 开始->所有程序->visual studio 2015 ->vs2015 x64 本机工具命令提示符 打开。
4、cd到解压的目录,运行 .\bootstrap.bat; 等待 在该目录下会生成 bjam.exe
5、接着输入
bjam stage --toolset=msvc-14.0 architecture=x86 address-model=64 --without-graph --without-graph_parallel --stagedir="你自己的路径\boost_1_66_0\newbuild" link=static runtime-link=shared runtime-link=static threading=multi debug release
注意:你自己的路径\boost_1_66_0\newbuild是自定义的目录,此目录存放编译成功的静态库。
漫长的编译过程。。。。。。。
6、配置boost库:
要将解决方案平台改成x64
vs2015 新建项目。然后该项目的属性页:c/c++ 常规 附加包含目录:设置为:你自己的路径\boost_1_66_0;
然后 链接器 常规 附加库目录 设置为 你自己的路径\boost_1_66_0\newbuild\lib;
7、测试
- #include "stdafx.h"
- #include<iostream>
- #include<string>
- #include<boost/thread.hpp>
- using namespace std;
- void mythread()
- {
- cout << " hello,thread! " << endl;
- }
- int main()
- {
- boost::function<void()> f(mythread);
- boost::thread t(f);
- t.join();
- cout << " thread is over! " << endl;
- return 0;
- }
若运行成功,则说明已经安装好了(类似opencv3的安装配置)。