设为首页 加入收藏

TOP

编译并使用Boost库(Win7+Boost1.53+VS2012)
2014-11-23 22:15:50 来源: 作者: 【 】 浏览:38
Tags:编译 使用 Boost Win7 Boost1.53 VS2012

从http://www.boost.org上下载到目前最新的boost库,快速传送门:boost_1_53_0.zip,当然你也可以从http://sourceforge.net/projects/boost/files/boost-jam/这里得到源代码,快速传送门:boost_1_53_0.zip(98.1 MB)


我使用了后者




进入到源代码目录中



指定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库解压在F盘下




设定库目录:




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


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


#include "stdafx.h"
#include "boost/thread.hpp"
#include "iostream"
using namespace std;


void mythread()
{
cout << " hello,thread! " << endl;
}


int _tmain(int argc, _TCHAR* argv[])
{
boost::function f(mythread);
boost::thread t(f);
t.join();
cout << " thread is over! " << endl;



return 0;
}



】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇VS2010 Boost编译安装 下一篇remove()和直接使用system的一个..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: