windows下vs2012+Boost库安装使用

    以前在linux下装过Boost,但是介于自己目前最常用的开发平台还是windows,所以查了下怎么在windows下安装并使用Boost(只是mark了别人的博客放自己这里方便自己查找);


推荐个学习Boost的网站  http://zh.highscore.de/cpp/boost/

        

1、下载boost库

从http://www.boost.org上下载到目前最新的boost库,快速传送门:Boost_1_67_0


2、得到源代码之后,使用vs2012的cl.exe编译



进入到源代码目录中


3、建立编译工具bjam.exe----需要执行bootstrap.bat



4、指定编译命令


指定msvc版本11.0对应的是vs2012,--stagedir是指定编译后存放的目录

 

bjam stage --toolset=msvc-11.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-python --without-serialization --without-wave --stagedir="D:\VS2012\boost_1_67_0\bin\vc11" link=static runtime-link=shared runtime-link=static threading=multi debug release


 

稍微等一会(其实还挺久的),库就编译好了……


5、开始使用boost

在vs2012上设置如下

然后开始使用吧!

下面是测试代码

    #include "boost/thread.hpp"  
    #include "iostream"  
    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;  
    }  
对了。编译完目录下的那个 bin.v2是个临时文件夹,(非常大 硬盘容量吃紧的就删掉吧!)


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值