boost编译参数

下载Boost源代码与安装VS

博主使用的是版本boost_1_61_0、vs2008或者vs2010

1.解压boost文件,使用编译器的命令行进入解压后的根目录

2.敲入命令.\bootstrap.bat (on Windows)或者./bootstrap.sh (on other operating systems)

3.执行./b2 install --prefix=PREFIX

PREFIX就是你要安装的目录位置,Win32默认在 C:\Boost;Unix默认在 /usr/local on Unix. Linux

4.可选的。可以将PREFIX/bin设置为环境变量方便使用

下面就是开始boost的hello之旅了

http://blog.csdn.net/xinqingwuji/article/details/51737177

博主使用的命令:b2 stage --toolset=msvc-9.0 variant=debug link=shared threading=multi runtime-link=shared

20170420补充

使用动态库链接还是乖乖的,运行时还需要一堆动态库,后来还是从了静态库。。。。

修改为b2 install --toolset=msvc-10.0 variant=debug link=static threading=multi runtime-link=shared


仅供参看,使用都是动态链接

详细解释:

第二步执行后在boost根目录(也是bootstrap.bat的目录)下会生成b2.exe、bjam.exe、project-config.jam、bootstrap.log四个文件。

第三步执行的是默认安装。可以键入b2 --help来查看编译的配置情况。


博主参考的配置参数:

b2 stage/install

重要参数说明:

[install|stage]:

stage:只在stage目录下放置编译的库文件,可以由--stagedir=<STAGEDIR>选项来指定目录。默认是根目录stage目录下。

install:会生成一些boost的头文件目录include文件,直接使用。

toolset:


win32下的版本msvc-6.0 :  VC6.0    msvc-7.0:  VS2003    msvc-8.0:  VS2005    msvc-9.0:  VS2008    msvc-10.0:  VS2010

--with-<library>:指定编译的库
--without-<library>:指定不编译的库。默认是全编译的

--show-libraries:显示需要编译的全部库文件

variant=debug|release 编译的版本debug或者release

link=static|shared  静态或者动态编译库

threading=single|multi  单线程或者多线程。一般当然还是多线程环境多。

runtime-link=static|shared  静态链接或者动态链接C/C++运行库

--build-type=<type>:

complete  编译所有可能的变量,相当于variant=release,threading=multi;link=shared|static;runtime-link=shared


Boost库命名特点:

1.包含boost单词

2.link=static,生成的库lib开头,然后再接boost

3.threading=mult,生成的库加入关键词-mt

4.variant=debug,生成的库加入关键词-gd

5.runtime-link=static,生成的库加入关键词-s

FeatureAllowed valuesNotes

variant

debug,release

link

shared,static

Determines if B2 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 the section called “C++ Compilers” and your compiler documentation in case of problems.

toolset

(Depends on configuration)

The C++ compiler to use. See the section called “C++ Compilers” 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 SYMBOL or 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编译 Boost 1.82 版本,你可以按照以下步骤进行操作: 1. 首先,确保你已经安装了编译工具链(如gcc、g++等)和必要的依赖项(如Python)。 2. 下载 Boost 1.82 版本的源代码,你可以从 Boost 官方网站(https://www.boost.org/users/download/)或 GitHub(https://github.com/boostorg/boost/releases)获取源代码包。 3. 解压下载的源代码包到你希望存放 Boost 源码的目录中。 4. 打开终端或命令提示符,并进入 Boost 源码目录。 5. 运行以下命令来生成 Boost 构建系统的配置文件: ``` ./bootstrap.sh ``` 如果你使用的是 Windows 平台,可以运行 `bootstrap.bat`。 6. 配置 Boost 编译选项。你可以使用 `./b2 --help` 命令来查看可用的选项,例如指定编译器版本、库安装目录等。根据你的需求进行相应的配置。 7. 运行以下命令来开始编译 Boost 库: ``` ./b2 ``` 如果你想加快编译速度,可以使用多线程编译。例如,可以使用 `-j4` 参数来指定使用 4 个线程进行编译。 8. 等待编译完成。这可能需要一段时间,具体取决于你的系统配置和编译选项。 9. 编译完成后,你可以在 Boost 源码目录中找到生成的库文件和头文件。根据你的需求,将它们复制到适当的位置供你的项目使用。 注意:编译 Boost 可能会因为系统环境和配置的不同而出现问题。如果你遇到任何错误或困难,请参考 Boost 官方文档(https://www.boost.org/doc/libs/1_82_0/more/getting_started/index.html)或社区论坛,以获取更多帮助。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值