win7_64bit + vs2012(vc11) + boost_1_53_0

以前配置过vs2010+boost_1_49_0,现在安装vs2012了,所以得重新编译配置,而且boost的版本也有更新。

       首先下载boost,这个可以再官网上下载,http://www.boost.org,下载后,解压保存在你要编译的硬盘下,最后编译的文件就要保存在解压的这个文件下。

       然后进行编译,打开vs2012的本地工具 (vs2012 x86 Native  Tools Command Prompt)

               

转到解压的boost的目录,执行bootstrap.bat ,以建立编译工具bjam.exe 。


                           


   然后在进行编译执行:

   指定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="F:\boost\boost_1_53_0\bin\vc11" link=static runtime-link=shared runtime-link=static threading=multi debug release


约需要半个小时,编译完成。

      最后 开始使用boost。

首先需要设定文件包含目录:

我的boost库解压在F盘下




设定库目录:




“F:\boost\boost_1_53_0\”是我编译的出来lib的目录


然后建立我们的第一个boost项目,代码如下:


  1. #include "stdafx.h"  
  2. #include "boost/thread.hpp"  
  3. #include "iostream"  
  4. using namespace std;  
  5.   
  6. void mythread()  
  7. {  
  8.     cout << " hello,thread! " << endl;  
  9. }  
  10.   
  11. int _tmain(int argc, _TCHAR* argv[])  
  12. {  
  13.     boost::function<void()> f(mythread);  
  14.     boost::thread t(f);  
  15.     t.join();  
  16.     cout << " thread is over! " << endl;  
  17.   
  18.   
  19.     return 0;  
  20. }  


这是输出:




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值