gpt4 book ai didi

c++ - 为什么我们需要构建一个 boost 库,仅仅包含头文件还不够吗,因为 boost 是模板

转载 作者:行者123 更新时间:2023-11-28 01:17:28 26 4
gpt4 key购买 nike

如果这是一个幼稚的问题,我很抱歉,我只是想知道为什么需要构建 boost 库,因为使用boost库包中的bootstrap文件构建一个包含.lib .dll静态库和动态库的库。据我所知,boost是一个模板库,构建二进制库没有意义,你可以直接包含头文件并直接使用...

最佳答案

对于 Boost 问题,Boost 网站是寻找答案的好地方,特别是 getting started on Unix varients 中出现的“仅 header 库”部分和 getting started on Windows .

Nothing to Build?

Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking.

请注意,这里使用的是“大部分”,而不是“全部”。在 1.71 版本中,有 16 个库必须单独构建,7 个库具有可选的单独编译组件。 (Boost 站点有这些库的列表,并且该列表会随着新版本的发布而更新。)如果您没有使用这些特定的库,那么对了,您可以只包含 header 而不链接到 Boost 库。

关于c++ - 为什么我们需要构建一个 boost 库,仅仅包含头文件还不够吗,因为 boost 是模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58161113/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com