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. Python 2.7 闭包的局限

    想法源自:http://stackoverflow.com/questions/141642/what-limitations-have-closures-in-python-compared-to- ...

  2. PGM:贝叶斯网的参数估计2

    http://blog.csdn.net/pipisorry/article/details/52599321 没时间看了,下次再看... 具有共享参数的学习模型 全局参数共享 局部参数共享 具有 共 ...

  3. 剑指Offer——知识点储备-网络基础

    剑指Offer--知识点储备-网络基础 计算机网络 http和https的区别 (1)http是http协议运行在tcp之上,所传输的内容都是明文,客户端和服务器端都无法验证对方的身份. (2)htt ...

  4. React Native之ScrollView控件详解

    概述 ScrollView在Android和ios原生开发中都比较常见,是一个 滚动视图控件.在RN开发中,系统也给我们提供了这么一个控件.不过在RN开发中 ,使用ScrollView必须有一个确定的 ...

  5. Python 描述符 data 和 non-data 两种类型

    仅包含__get__的,是non-data descriptor, 如果实例__dict__包含同名变量, 则实例优先; 如果还包含__set__, 则是data descriptor, 优先于实例_ ...

  6. Xcode7.3中SKAudioNode"诡异"初始化的解决

    大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请多提意见,如果觉得不错请多多支持点赞.谢谢! hopy ;) 我没有在之前版本的Xcode中测试,不过很多人反映SKAudi ...

  7. Android 网络图片加载之cude 框架

    偶然发现了这个框架,阿里图片加载用的这个框架.非常简单操作步骤. 1.首先下载软件包,直接搜Cube ImageLoader 这个. 2.加入jar文件 3.使用前的配置: public class ...

  8. Apache commons email 使用过程中遇到的问题

    apache-commons-email是对mail的一个封装,所以使用起来确实是很方便.特别的,官网上的tutorial也是极其的简单.但是我也仍然是遇到了没有解决的问题. jar包的添加 mail ...

  9. Java继承时的初始化顺序

    Java程序在启动和运行时,需要首先完成初始化的工作.在涉及到继承.static成员变量等因素时,初始化的顺序就复杂起来.下面以一个例子说明继承时的Java初始化顺序. 例子: class Insec ...

  10. Struts2中的struts.multipart.saveDir的配置

    <constant name="struts.multipart.saveDir" value="D:\\AsimsTemp"></const ...