在linux环境编译boost

1.在boost官网:http://www.boost.org/下载相应版本的boost

2.解压boost到相应目录,在boost跟目录下有b2可执行程序,可以通过输入命令“/b2 --help”,查看相应的参数设置。

例如:

--build-dir= <builddir> 编译的临时文件会放在builddir里(这样比较好管理,编译完就可以把它删除了)

--stagedir= <stagedir> 存放编译后库文件的路径,默认是stage

--build-type= complete 编译所有版本,不然只会编译一小部分版本(确切地说是相当于:variant=release, threading=multi;link=shared|static;runtime-link=shared)

variant= debug|release 决定编译什么版本(Debug or Release?)

link= static|shared 决定使用静态库还是动态库。

threading= single|multi 决定使用单线程还是多线程库。

runtime-link= static|shared 决定是静态还是动态链接C/C++标准库。

--with- <library> 只编译指定的库,如输入--with-regex就只编译regex库了。

--without-<library>除了指定的库,其他库都编译

--show- libraries 显示需要编译的库名称

3.在编译boost库时遇到 uintptr_t 缺失等类似问题,是由于库使用的C++版本为C++11,需在相关文件初始部分添加#include <stdint.h>,重新编译后即可解决问题。

4.详细参考boost目录下index.html

posted @ 2015-12-03 10:48  pinhole  阅读(499)  评论(0编辑  收藏  举报