告诉我编译器在这里做了什么?

时间:2010-09-06 11:34:00

标签: c linux

请告诉我它的作用?

$ ar -r libsldap.a

2 个答案:

答案 0 :(得分:14)

“教一个人钓鱼”,我说:

> man ar

[...]
DESCRIPTION
       The GNU ar program creates, modifies, and extracts from archives.  An
       archive is a single file holding a collection of other files in a
       structure that makes it possible to retrieve the original individual
       files (called members of the archive).
[...]

man是你的朋友。

答案 1 :(得分:3)

ar -r libsldap.a list-of-object-files

此行创建Linux静态库,它实际上是包含一个或多个.o文件的归档文件。之前使用编译器来创建这些.o文件。

http://www.linux.org/docs/ldp/howto/Program-Library-HOWTO/static-libraries.html