博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何安装boost库
阅读量:4042 次
发布时间:2019-05-24

本文共 3182 字,大约阅读时间需要 10 分钟。

详细教程可以参考:http://www.boost.org/doc/libs/1_55_0/more/getting_started/windows.html#id32

1.下载boost

http://sourceforge.net/projects/boost/?source=typ_redirect

2.解压到目标文件夹

我这里解压到D:\work_files

3.编译库

在CMD下面,进入D:\work_files\boost_1_55_0

输入下面语句

boostrap

.\b2

注意如果编译出来版本不对的话,就得自己写个批处理文件

内容如下:

bjam toolset=msvc-11.0 variant=release threading=multi link=static define=_SECURE_SCL=0 define=_HAS_ITERATOR_DEBUGGING=0bjam toolset=msvc-11.0 variant=debug threading=multi link=static
命名为boost_build.bat,放在D:\work_files\boost_1_55_0目录下,然后在cmd中执行它

具体选项

Feature Allowed values Notes
variant debug,release  
link shared,static Determines if Boost.Build creates shared or static libraries
threading single,multi Cause the produced binaries to be thread-safe. This requires proper support in the source code itself.
address-model 32,64 Explicitly request either 32-bit or 64-bit code generation. This typically requires that your compiler is appropriately configured. Please refer to  and your compiler documentation in case of problems.
toolset (Depends on configuration) The C++ compiler to use. See  for a detailed list.
include (Arbitrary string) Additional include paths for C and C++ compilers.
define (Arbitrary string) Additional macro definitions for C and C++ compilers. The string should be either SYMBOLor SYMBOL=VALUE
cxxflags (Arbitrary string) Custom options to pass to the C++ compiler.
cflags (Arbitrary string) Custom options to pass to the C compiler.
linkflags (Arbitrary string) Custom options to pass to the C++ linker.
runtime-link shared,static Determines if shared or static version of C and C++ runtimes should be used.

具体版本

Product name Codename Version number
version
Supported .NET
Framework versions
Release date
Visual Studio 4.0 N/A 4.0 N/A N/A April 1995
Visual Studio 97 Boston 5.0 N/A N/A February 1997
Visual Studio 6.0 Aspen 6.0 12.00 N/A June 1998
Visual Studio .NET (2002) Rainier 7.0 13.00 1.0 February 13, 2002
Visual Studio .NET 2003 Everett 7.1 13.10 1.1 April 24, 2003
Visual Studio 2005 Whidbey 8.0 14.00 2.0, 3.0 November 7, 2005
Visual Studio 2008 Orcas 9.0 15.00 2.0, 3.0, 3.5 November 19, 2007
Visual Studio 2010 Dev10/Rosario 10.0 16.00 2.0 – 4.0 April 12, 2010
Visual Studio 2012 Dev11 11.0 17.00 2.0 – 4.5.2 September 12, 2012
Visual Studio 2013 Dev12 12.0 18.00 2.0 – 4.5.2 October 17, 2013
Visual Studio 2015 Dev14 14.0 19.00 2.0 – 4.6 July 20, 2015

4.使用boost

设置Include目录:D:\work_files\boost_1_55_0

设置Lib目录:D:\work_files\boost_1_55_0\stage\lib

boost_wave-vc100-mt-gd-1_55.dll

这里mt代表multi thread

gd 代表 debug版本

然后就可以试试两个测试程序

一个测试头文件:

#include 
#include
#include
#include
int main(){ using namespace boost::lambda; typedef std::istream_iterator
in; std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " );}

一个测试库文件:

#include 
#include
#include
int main(){ std::string line; boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" ); while (std::cin) { std::getline(std::cin, line); boost::smatch matches; if (boost::regex_match(line, matches, pat)) std::cout << matches[2] << std::endl; }}

转载地址:http://rkxdi.baihongyu.com/

你可能感兴趣的文章
[LeetCode By Python]121. Best Time to Buy and Sell Stock
查看>>
[LeetCode By Python]122. Best Time to Buy and Sell Stock II
查看>>
[LeetCode By Python]125. Valid Palindrome
查看>>
[LeetCode By Python]136. Single Number
查看>>
[LeetCode By MYSQL] Combine Two Tables
查看>>
Android下调用收发短信邮件等(转载)
查看>>
Android中电池信息(Battery information)的取得
查看>>
SVN客户端命令详解
查看>>
Android/Linux 内存监视
查看>>
Linux系统信息查看
查看>>
用find命令查找最近修改过的文件
查看>>
Android2.1消息应用(Messaging)源码学习笔记
查看>>
Android之TelephonyManager类的方法详解
查看>>
android raw读取超过1M文件的方法
查看>>
ubuntu下SVN服务器安装配置
查看>>
MPMoviePlayerViewController和MPMoviePlayerController的使用
查看>>
CocoaPods实践之制作篇
查看>>
[Mac]Mac 操作系统 常见技巧
查看>>
苹果Swift编程语言入门教程【中文版】
查看>>
捕鱼忍者(ninja fishing)之游戏指南+游戏攻略+游戏体验
查看>>