如何合并两个“ar"静态库合二为一? [英] How to merge two "ar" static libraries into one?

查看:36
本文介绍了如何合并两个“ar"静态库合二为一?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 2 个静态 Linux 库,分别由 ar crlibabc.alibxyz.a 创建.
我想将它们合并到一个静态库 libaz.a.
我该怎么做.

I have 2 static Linux libraries, created by ar cr, libabc.a and libxyz.a.
I want to merge them into one static library libaz.a.
How can I do this.

我想创建一个合并的静态库,而不是将两个库都提供给应用程序的最终链接.

I want to create a merged static library, not to give both libraries to final link of applications.

推荐答案

您可以从 .a 文件中提取对象,并使用提取的 .os:

You can extract the object from both the .a files and create your .a file using the extracted .os:

ar -x libabc.a
ar -x libxyz.a
ar -c libaz.a  *.o

这篇关于如何合并两个“ar"静态库合二为一?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆