source URL: http://stackoverflow.com/questions/2629421/how-to-use-boost-in-visual-studio-2010

While the instructions on the Boost web site are helpful,
here is a condensed version that also builds x64 libraries.

  • You only need to do this if you are using one of the libraries mentioned in section
    3
     of the instructions page. (E.g., to use Boost.Filesystem requires compilation.) If you are not using any of those, just unzip and go.

Build the 32-bit libraries

This installs the Boost header files under C:\Boost\include\boost-(version),
and the 32-bit libraries under C:\Boost\lib\i386.
Note that the default location for the libraries is C:\Boost\lib but
you’ll want to put them under an i386 directory
if you plan to build for multiple architectures.

  1. Unzip Boost into a new directory.
  2. Start a 32-bit MSVC command prompt and change to the directory where Boost was unzipped.
  3. Run: bootstrap
  4. Run: b2
    toolset=msvc-12.0 --build-type=complete --libdir=C:\Boost\lib\i386 install

    • For Visual Studio 2012, use toolset=msvc-11.0
    • For Visual Studio 2010, use toolset=msvc-10.0
  5. Add C:\Boost\include\boost-(version) to
    your include path.
  6. Add C:\Boost\lib\i386 to
    your libs path.

Build the 64-bit libraries

This installs the Boost header files under C:\Boost\include\boost-(version),
and the 64-bit libraries under C:\Boost\lib\x64.
Note that the default location for the libraries is C:\Boost\lib but
you’ll want to put them under an x64 directory
if you plan to build for multiple architectures.

  1. Unzip Boost into a new directory.
  2. Start a 64-bit MSVC command prompt and change to the directory where Boost was unzipped.
  3. Run: bootstrap
  4. Run: b2
    toolset=msvc-12.0 --build-type=complete --libdir=C:\Boost\lib\x64 architecture=x86 address-model=64 install

    • For Visual Studio 2012, use toolset=msvc-11.0
    • For Visual Studio 2010, use toolset=msvc-10.0
  5. Add C:\Boost\include\boost-(version) to
    your include path.
  6. Add C:\Boost\lib\x64 to
    your libs path.

Test code

// boost_lib.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/regex.hpp>
#include <boost/thread/thread.hpp>
using namespace std;

void wait(int seconds)
{
  boost::this_thread::sleep(boost::posix_time::seconds(seconds));
} 

void my_thread()
{
  for (int i = 0; i < 5; ++i)
  {
    wait(1);
    std::cout << i << std::endl;
  }
} 

int main()
{
  boost::thread t(my_thread);
  t.join();
} 

VS2010安装Boost库的更多相关文章

  1. VS2010 安装 Boost 库 1.54

    Boost库被称为C++准标准库, 功能很是强大, 下面记录我在VS2010中安装使用Boost库的过程. 首先上官网http://www.boost.org/下载最新的Boost库, 我的版本是1_ ...

  2. VS2010 安装boost库

    1.下载boost库 boost官网:www.boost.org,目前最新的版本是1.64,直接下载地址:https://dl.bintray.com/boostorg/release/1.64.0/ ...

  3. VS2010下安装boost库

    在我们的C++项目中安装boost库,下面以VS2010版本作为例子,其它版本的设置也差不多. 一.编译生成boost库 1.下载最新的boost(本人下载的是boost_1_56_0).boost官 ...

  4. ubuntu 下安装boost库

    ubuntu下安装boost库,,在网上试了一些其他人推荐的libboost-dev 但是会缺少,编译程序会报错: /usr/bin/ld: cannot find -lboost_serializa ...

  5. linux下编译安装boost库

    linux下编译安装boost库 linux下编译安装boost库 1.下载并解压boost 1.58 源代码 下载 解压 2.运行bootstrap.sh 3.使用b2进行构建 构建成功的提示 4. ...

  6. Centos 安装boost库

    1.在http://www.boost.org/下载boost安装包boost_1_65_1.tar.gz 2.在Centos上解压tar -zxvf  boost_1_65_1.tar.gz后,cd ...

  7. windows下编译和安装boost库

    boost是一个功能强大.构造精巧.跨平台.开源并且完全免费的C++程序库. 获取方式 boost提供源码形式的安装包,可以从boost官方网站下载,目前最新版本是1.59.0. 本机上正好有boos ...

  8. 树莓派上安装boost库

    一.安装boost库 sudo apt-get install libboost-dev aptitude search boost 二.编写测试代码 #include <iostream> ...

  9. 在RedHat 7.2中安装boost库

    在RedHat 7.2中安装boost库 环境,其它版本类似 Redhat7.2 64bit boost 1.64.0 步骤 去 boost官网 下载想要版本的.tar.gz,如下图 解压tar -v ...

随机推荐

  1. CSAPP缓冲区溢出攻击实验(下)

    CSAPP缓冲区溢出攻击实验(下) 3.3 Level 2: 爆竹 实验要求 这一个Level的难度陡然提升,我们要让getbuf()返回到bang()而非test(),并且在执行bang()之前将g ...

  2. 关于Java,那些我心存疑惑的事(不断更新中...)

    本文主要列出一些Java常用到确又让大家不怎么注意的问题. 将会不断更新,欢迎关注-- 如有觉得不合理之处,欢迎评论交流,没有火花怎么印象深刻? (1)Java到底是值传递?还是引用传递? 揪出这个问 ...

  3. Android等宽字体

    Android等宽字体 效果图 在xml中设置 添加属性 android:typeface="monospace" 例如 <TextView android:layout_w ...

  4. 剑指Offer——如何做好自我介绍(英文版)

    剑指Offer--如何做好自我介绍(英文版)   Good morning ladies and gentlemen, my name is Sun Huaqiang, my hometown loc ...

  5. Android TV开发总结(二)构建一个TV Metro界面(仿泰捷视频TV版)

    前言:上篇是介绍构建TV app前要知道的一些事儿,开发Android TV和手机本质上没有太大的区别,屏大,焦点处理,按键处理,是有别于有手机和Pad的实质区别.今天来介绍TV中Metro UI风格 ...

  6. Python 继承标准类时发生了什么

    定义标准类dict的一个子类c: >>> class c(dict): pass >>> y=c({1:2,3:4}) >>> y {1: 2, ...

  7. 详解EBS接口开发之供应商导入(补充)--错误信息处理

    check reject details on records of AP_SUPPLIER_INT SELECT s.parent_table,s.reject_lookup_code,S.LAST ...

  8. x264源代码简单分析:概述

    ===================================================== H.264源代码分析文章列表: [编码 - x264] x264源代码简单分析:概述 x26 ...

  9. Android初级教程Fragment到Fragment的通信初探

    这里只是给出三个类RightFragment.LeftFragment.MainActivity中的简易代码,至于布局怎么设定,不做赘述. 思路:从碎片一获取与之依托的活动实例,碎片一可以调用活动里面 ...

  10. Oracle 总账年终结算流程

     1.Oracle 总账应用中年终结算流程包含在开启/关闭期间程序里.当用户开启新一年的第一个期间,开启/关闭期间程序中的"gloire" 流程会完成传送所有收入及支出(损益表 ...