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

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

问题描述

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

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

gcc ... -static .. 。尝试静态链接所有链接的库,但我没有获得其中一些静态版本(例如: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天全站免登陆