C++ 哪些 Boost 库是仅标头的?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13604090/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 17:32:13  来源:igfitidea点击:

Which Boost libraries are header-only?

c++boost

提问by dangerousdave

Which Boost libraries are header-only? And which require building libraries?

哪些 Boost 库是仅标头的?哪些需要构建库?

Does such a list exist?

有这样的清单吗?

采纳答案by Mike Seymour

The list of libraries that require building is herefor Unix-like systems, and herefor Windows.

需要构建的库列表在这里适用于类 Unix 系统,在这里适用于 Windows。

For the current release, 1.58, both are the same:

对于当前版本 1.58,两者是相同的:

  • Boost.Chrono
  • Boost.Context
  • Boost.Filesystem
  • Boost.GraphParallel
  • Boost.IOStreams
  • Boost.Locale
  • Boost.MPI
  • Boost.ProgramOptions
  • Boost.Python
  • Boost.Regex
  • Boost.Serialization
  • Boost.Signals
  • Boost.System
  • Boost.Thread
  • Boost.Timer
  • Boost.Wave
  • Boost.Chrono
  • Boost.Context
  • Boost.Filesystem
  • Boost.GraphParallel
  • Boost.IOStreams
  • Boost.Locale
  • 增强型MPI
  • Boost.ProgramOptions
  • Boost.Python
  • Boost.Regex
  • Boost.Serialization
  • 升压信号
  • 升压系统
  • Boost.Thread
  • 升压定时器
  • Boost.Wave

A few libraries have optional separately-compiled binaries:

一些库具有可选的单独编译的二进制文件:

  • Boost.DateTime
  • Boost.Graph
  • Boost.Math
  • Boost.Random
  • Boost.Test
  • Boost.Exception
  • Boost.DateTime
  • Boost.Graph
  • Boost.Math
  • Boost.Random
  • Boost.Test
  • Boost.Exception

Note that some libraries may depend on these (for example, Asio depends on System as pointed out in the comments), so you may still need to build something even if the library you want isn't on the list.

请注意,某些库可能依赖于这些(例如,如注释中所指出的,Asio 依赖于 System),因此即使您想要的库不在列表中,您仍可能需要构建一些东西。

回答by Andrew Selivanov

Actually, even ./bootstrap.sh --show-librariesis somewhat incorrect too, because some libraries depend on that listed libraries.

实际上, even./bootstrap.sh --show-libraries也有些不正确,因为有些库依赖于列出的库。

It is possible to get list of header-only libraries with the Boost BCPtool, launching the tool on every library and removing those linking any binaries. That is what was done in How To Build Header Only Boost.

可以使用 Boost BCP工具获取仅标头库的列表,在每个库上启动该工具并删除那些链接任何二进制文件的库。这就是How To Build Header Only Boost 中所做的。

For Boost 1.67.0 the resulting list was:

对于 Boost 1.67.0,结果列表是:

accumulators
align
any
array
assert
assign
bind
callable_traits
circular_buffer
compatibility
concept_check
config
container_hash
conversion
convert
core
crc
detail
disjoint_sets
dynamic_bitset
endian
foreach
format
function
functional
function_types
fusion
geometry
gil
hana
heap
hof
icl
integer
interprocess
intrusive
io
iterator
lambda
lexical_cast
locale
local_function
logic
metaparse
move
mp11
mpl
msm
multi_array
multi_index
optional
phoenix
poly_collection
polygon
predef
preprocessor
property_tree
proto
ptr_container
qvm
ratio
rational
scope_exit
signals2
smart_ptr
sort
static_assert
throw_exception
tokenizer
tti
tuple
type_index
typeof
type_traits
units
unordered
utility
uuid
variant
vmd
winapi
xpressive

回答by Declan

I think the list above is not accurate even though it's from the official documentation. See https://svn.boost.org/trac10/ticket/13222

我认为上面的列表不准确,即使它来自官方文档。见https://svn.boost.org/trac10/ticket/13222

Instead you can query the list of libraries that need to be built:

相反,您可以查询需要构建的库列表:

>    ./bootstrap.sh --show-libraries

   The Boost libraries requiring separate building and installation are:

    atomic
    chrono
    container
    context
    coroutine
    date_time
    exception
    fiber
    filesystem
    graph
    graph_parallel
    iostreams
    locale
    log
    math
    metaparse
    mpi
    program_options
    python
    random
    regex
    serialization
    signals
    stacktrace
    system
    test
    thread
    timer
    type_erasure
    wave

Note: On Windows you have to call bootstrap.batto build "b2" and then call b2 --show-librariesinstead.

注意:在 Windows 上,您必须调用 bootstrap.bat构建“b2”,然后调用b2 --show-libraries