[英]What is the reason for a library to not be header-only?
I really like using header-only libraries, as they are really easy to use (no linker issues or having to compile the library separately). 我真的很喜欢使用仅限标头的库,因为它们非常容易使用(没有链接器问题或者必须单独编译库)。 For example most of the Boost library is header-only. 例如,大多数Boost库都是仅标题库。 But then again there are some parts, like boost::python, which requires to be build before. 但是又有一些部分,比如boost :: python,需要先构建。 Is this a design choice or a technical necessity? 这是设计选择还是技术必需品?
I gave Boost as an example but would appreciate a more general answer if possible. 我给了Boost作为一个例子,但如果可能的话,我会很感激。
The original reason to use compiled libraries is to spare compilation time. 使用编译库的最初原因是为了节省编译时间。 Libraries can be big. 图书馆可能很大。 They can be huge. 它们可能很大。
Another argument is that they keep the source code apart. 另一个论点是他们将源代码分开。 There is still a good deal of the universe which is not open-sourced. 还有很多宇宙不是开源的。
In favor of header only: 仅支持标题:
Against header only: 仅反对标题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.