BOOST 在Windows和Linux下的安装及说明

来源:互联网 发布:陕西省大数据集团领导 编辑:程序博客网 时间:2024/05/17 03:56

一、下载:http://www.boost.org/users/download/     如boost_x_xx_x.zip

二、安装:

一)Windows

解压到某目录(E:\boost_x_xx_x\),执行bootstrap.bat,在运行编译程序b2.exe。仅需要编译部分lib的方法参见下面Linux部分

即,头文件额外指定“E:\boost_1_53_0”,然后引用是直接#include <boost/regex.hpp>,包含库类似。
更详细的说明参看这里:编译Boost 详细步骤 适用 VC6 VS2003 VS2005 VS2008 VS2010 

——2014年2月9日 16:56:23 补充
下面两个资料更为详细的介绍
1、【原】Boost下载安装编译配置使用指南(含Windows、Linux以及ARM Linux)
2、选择性编译Boost组件

二)Linux

1.下载后解压到某位置下:/boost_x_xx_x

2.编译bjam:

#cd boost_1_53_0#./bootstrap.sh

3.查看支持哪些lib:

./bjam --show-libraries

4.编译boost:

sudo ./bjam install stage --toolset=gcc --without-graph --without-graph_parallel --without-math --without-mpi --without-python --without-serialization --without-program_options --without-test --without-wave --stagedir="./gcc" link=static runtime-link=shared  threading=multi variant=release

install表示编译完成之后安装到/usr/local目录下;stage表示只生成dll和lib;--toolset指定生成的编译器;--stagedir表示保存的目录;link表示连接boost库的方式;runtime-link表示连接C/C++运行时库的方式;threading表示单/多线程;variant表示debug或者release。大约要个十几分钟。编译完成后根据提示查看有无错误。

5.安装完毕,开始使用:头文件目录——/usr/local/include/boost,库目录——/usr/local/lib

6.注意:A.在编译boost-iostreams时可能提示“error: bzlib.h: No such file or directory boost ”,表示iostreams依赖libbz2,

sudo apt-get install libbz2-dev

参考资料:

1、Windows环境下使用Boost
2、linux下安装boost
3、编译Boost 详细步骤 适用 VC6 VS2003 VS2005 VS2008 VS2010 
4、[boost c++开源库学习笔记]boost库在Linux下的环境搭建,编译使用 boost_1_54_0版本。
5、【原】Boost下载安装编译配置使用指南(含Windows、Linux以及ARM Linux)
6、Boost库命名规则
7、引领Boost(一)(开篇)

原创粉丝点击