仅静态链接一些库 [英] static linking only some libraries

查看:21
本文介绍了仅静态链接一些库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在与 GCC 链接时,如何仅将某些特定库静态链接到我的二进制文件?

How can I statically link only a some specific libraries to my binary when linking with GCC?

gcc ... -static ... 尝试静态链接 all 链接的库,但我没有其中一些的静态版本(例如: libX11).

gcc ... -static ... tries to statically link all the linked libraries, but I haven't got the static version of some of them (eg: libX11).

推荐答案

gcc -lsome_dynamic_lib code.c some_static_lib.a

这篇关于仅静态链接一些库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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