如何几个C / C ++库合并成一个? [英] How to combine several C/C++ libraries into one?

查看:195
本文介绍了如何几个C / C ++库合并成一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我累了添十座链接库到我的项目,或要求他们八用我自己的。我想利用现有的库,例如libpng.a,libz.a,libjpeg.a,并将它们合并成一个单一的.A库。那可能吗?如何结合的.lib库?

I'm tired of adding ten link libraries into my project, or requiring eight of them to use my own. I'd like to take existing libraries like libpng.a, libz.a, libjpeg.a, and combine them into one single .a library. Is that possible? How about combining .lib libraries?

推荐答案

在类Unix系统中,LD和Ar实用程序可以做到这一点。请查看 http://en.wikipedia.org/wiki/Ar_(Unix)或查找在任何Linux框或通过谷歌,如UNIX手册AR'的手册页。

On Unix like systems, the ld and ar utilities can do this. Check out http://en.wikipedia.org/wiki/Ar_(Unix) or lookup the man pages on any linux box or through google, e.g 'unix man ar'.

请注意,您可能会更好连接到共享(动态)库。这将添加一个依赖于你的可执行文件,但将大大减少它的大小,特别是如果你正在编写一个应用程序图形

Please note that you might be better off linking to a shared (dynamic) library. This would add a dependency to your executable but will dramatically reduce its size, especially if you're writing a graphic application.

这篇关于如何几个C / C ++库合并成一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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