gpt4 book ai didi

unix - 静态库创建

转载 作者:行者123 更新时间:2023-12-04 06:51:31 24 4
gpt4 key购买 nike

一般来说
我们使用 ar rcs命令在 unix 上创建静态库。

这里的标志's'是什么意思
手册页说

Do not generate an archive symbol table. This can speed up building a large library in several steps. The resulting archive can not be used with the linker. In order to build a symbol table, you must omit the S modifier on the last execution of ar, or you must run ranlib on the archive.



我被这句话搞糊涂了
“生成的存档可以
不能与链接器一起使用。”。

我们是否必须在 ar 命令之后使用 ranlib 来创建静态库?
ranlib 的目的是什么以及它是如何使用的?

最佳答案

ranlib实用程序在链接器用来进行查找的库中创建一个索引。注意 ar 中的 omit index 命令是大写 S - 构建索引的命令是小写 s,您应该使用它。没有必要使用ranlib运行后 ar rcs .

关于unix - 静态库创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3054705/

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