VS2012 下编译boost1.52

VS2012 下编译boost1.52

1. 下载boost_1_52_0.7z
    http://sourceforge.net/projects/boost/files/boost/1.52.0/

2. 解压缩到d:\boost目录下
3. 编译bjam
(1)从开始菜单运行“VS2012 开发人员命令提示”
(2)cd到D:\boost\boost_1_52_0下执行bootstrap.bat,然后,会在D:\boost\boost_1_52_0下生成bjam.exe
4.设定编译环境
   我的机器上仅安装了VS2012所以未配置
5. 编译boost库 
    本人使用的bjam命令如下:
bjam stage --toolset=msvc-11.0 --without-graph --without-graph_parallel --without-math --without-mpi --without-python --without-serialization --without-wave --stagedir="D:\boost\boost_1_52_0\bin\vc11" link=static runtime-link=shared runtime-link=static threading=multi debug release
    15分钟编译完毕。
    关于编译的取舍参考 :http://www.boost.org/doc/libs/1_52_0/more/getting_started/windows.html

The only Boost libraries that must be built separately are:

A few libraries have optional separately-compiled binaries:

  • Boost.DateTime has a binary component that is only needed if you're using its to_string/from_string or serialization features, or if you're targeting Visual C++ 6.x or Borland.
  • Boost.Graph also has a binary component that is only needed if you intend to parse GraphViz files.
  • Boost.Math has binary components for the TR1 and C99 cmath functions.
  • Boost.Random has a binary component which is only needed if you're using random_device.
  • Boost.Test can be used in “header-only” or “separately compiled” mode, although separate compilation is recommended for serious use.

6.设定vs2012环境

用VS 2012新建一个win32控制台应用程序名为Hello。
“属性管理” -> Microsoft.Cpp.Win32.user -> 右键“属性”
在弹出的对话框"C++目录" -> “包含目录”添加 D:\boost\boost_1_52_0
                                   -> “库目录”添加 D:\boost\boost_1_52_0\bin\vc11\lib

通过使用 boost/regex.hpp 简单程序判断配置正确。

复制代码
#include <boost/timer.hpp>
#include <cassert>
#include "boost/regex.hpp" 
using namespace boost;

int _tmain(int argc, _TCHAR* argv[])
{
    cout << "Hello , World !" << endl;

    timer t;
    cout << "elapsed_max " << t.elapsed_max() / 3600 << "h" <<endl;
    cout<< "elapsed_min " << t.elapsed_min() << "s" << endl;
    cout << "elapsed " << t.elapsed() << "s" <<endl;

    // 3 digits, a word, any character, 2 digits or "N/A", 
    // a space, then the first word again 
    boost::regex reg("\\d{3}([a-zA-Z]+).(\\d{2}|N/A)\\s\\1"); 

    std::string correct="123Hello N/A Hello"; 
    std::string incorrect="123Hello 12 hello"; 

    assert(boost::regex_match(correct,reg)==true); 
    assert(boost::regex_match(incorrect,reg)==false); 

    
    return 0;
}
复制代码

 主要参考 :

http://www.cnblogs.com/wondering/archive/2009/05/21/boost_setup.html

http://www.cppblog.com/flyinghare/archive/2010/09/07/126078.aspx
http://chenrongya.blog.163.com/blog/static/874741962010102041157963/

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、下 4载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、下载 4使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合;、下载 4使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值