vs2012 编译boost


  1. 安装 Visual Studio 2012.
  2. 安装更新 Visual Studio 2012..
  3. 下载 Boost from SourceForge.
  4. 解压 boost
  5. 用管理员权限运visual Studio 2012 tools Commands, 开始..Microsoft Visual Studio 2012..Visual Studio Tools..x64 Native Tools Command Prompt.
  6. 用命令切换到boost所在目录 cd c:\boost153.
  7. 运行 bootstrap.bat.
  8. 运行 bjam.exe. 构建所有库,忽略所有警告
  9. 编译完成时会提示如下内容(可能要花好长时间,随电脑配置而定):

    The Boost C++ Libraries were successfully built!
    The following directory should be added to compiler include paths:
       C:/boost153
    The following directory should be added to linker library paths:
       C:\boost153\stage\lib
  10. 接下来在Visual Studio 里加入路径.

  11. 创建C++ project.
  12. 在建Project之前, 添加 C:/boost153compiler include pathC:\boost153\stage\liblinker library path.
  13. 选择Visual StudioProperties, 选择t Configuration Properties..VC++ Directoriesenter image description here
  14. 写一个demo:

    // Source code below copied from:   
    // http://www.boost.org/doc/libs/1_53_0/doc/html/foreach.html
    #include "stdafx.h"
    
    #include <string>
    #include <iostream>
    #include <conio.h> // Supports _getch()
    #include <boost/foreach.hpp>
    
    int main()
    {
        std::string hello( "Hello, world!" );
    
        BOOST_FOREACH( char ch, hello )
        {
            std::cout << ch;
        }
    
        _getch();
        return 0;
    }
  15. 运行结果:

    Hello, world!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值