c++ - 如何构建boost序列化库

标签 c++ boost build compilation boost-serialization

我在某处看到boost的序列化库必须要编译(忘了是在哪看到的,不然我早就发链接了)。

所以我从 source forge 下载了最新版本并将其解压缩到我项目的路径中。 现在呢?

我调查了该文件夹,但找不到 makefile

那么我必须做什么,才能编译 boost:serialization 库?

编辑:尽管如此,我尝试使用它,但没有编译它,但我得到了这个错误:

boost/archive/basic_xml_oarchive.hpp:92:9: error: 
no matching function for call to 'assertion_failed'
    BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

所以我认为这是因为它没有被编译。是吗?

最佳答案

要构建 Boost,请遵循说明 here .

根据您的评论,您只想构建 Boost 的一部分(序列化)。如果您点击上面的链接,有一节包含以下建议(措辞可能有所不同,我从 Windows 说明中复制了它):

For a description of other options you can pass when invoking b2, type:

b2 --help

In particular, to limit the amount of time spent building, you may be interested in:

  • reviewing the list of library names with --show-libraries
  • limiting which libraries get built with the --with-library-name or --without-library-name options

键入 b2 --show-libraries 会产生以下结果:

The following libraries require building:
    - atomic
    - chrono
    - context
    - coroutine
    - date_time
    - exception
    - filesystem
    - graph
    - graph_parallel
    - iostreams
    - locale
    - log
    - math
    - mpi
    - program_options
    - python
    - random
    - regex
    - serialization
    - signals
    - system
    - test
    - thread
    - timer
    - wave

因此,要仅构建序列化,请将选项 --with-serialization 传递给 b2,例如要使用 VS2013 构建所有库类型(静态/动态库、静态/动态运行时、调试/发布、单线程/多线程),您可以键入以下内容:

b2 toolset=msvc-12.0 --with-serialization --build-type=complete stage

请注意,如果您计划在未来的项目中使用 Boost,那么只构建整个东西(即省略 --with-serialization 选项)可能会更简单,这样所有的库都是随时可以随时使用。

关于c++ - 如何构建boost序列化库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21141243/

相关文章:

c++ - 如何以编程方式停止进程

c++ - boost 函数组成

c++ - 用于组合类的 Boost Karma 生成器

logging - 如何将自定义日志添加到 Visual Studio Team Services 构建的日志输出?

c++ - 如何使用 std::string 作为 stxxl::map 中的键

c++ - 无法在原生 Dart 扩展中链接 v8

c++ - Xcode 文件夹和组混淆

c++ - boost::geometry::model::linestring 与 boost::geometry::model::polygon 的交集

ios - Swift iOS 构建错误,找不到文件

msbuild - ResolveProjectReferences 如何工作?