【问题标题】:Which Boost libraries are header-only?哪些 Boost 库是仅头文件?
【发布时间】:2023-03-03 01:22:01
【问题描述】:

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

这样的列表存在吗?

【问题讨论】:

    标签: c++ boost


    【解决方案1】:

    对于类 Unix 系统,需要构建的库列表是 here,对于 Windows 是 here

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

    • Boost.Chrono
    • Boost.Context
    • Boost.文件系统
    • Boost.GraphParallel
    • Boost.IOStreams
    • Boost.Locale
    • Boost.MPI
    • Boost.ProgramOptions
    • Boost.Python
    • Boost.Regex
    • Boost.序列化
    • Boost.Signals
    • Boost.System
    • Boost.Thread
    • Boost.Timer
    • Boost.Wave

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

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

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

    【讨论】:

    【解决方案2】:

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

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

    对于 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
    

    【讨论】:

      【解决方案3】:

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

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

      >    ./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
      

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-06-13
        • 1970-01-01
        • 1970-01-01
        • 2012-03-27
        • 2011-01-12
        • 1970-01-01
        • 2014-12-24
        • 1970-01-01
        相关资源
        最近更新 更多