如何静态链接到libc? [英] How to link to libc statically?
本文介绍了如何静态链接到libc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的程序包含< stdlib.h> ,< string.h中>我想静态链接到包含这些库的libc,而不是动态地执行!!
所以,首先是可能的吗?
如果是的话!请你给我这个语法吧!
提前谢谢。
我尝试了什么:
i have a program that includes <stdlib.h> ,<string.h> and i want to statically link to the libc that contains these libraries , rather than do it dynamically !!
so , first is it possible ?
if it's yes ! could you give me the syntax please !
thanks in advance.
What I have tried:
gcc <objectfiles> -static -lstatic1 -lstatic2
我在google上找到这个,但我不明白!
i found this one while looking on google , but i didn't understand it !
推荐答案
参见使用GNU编译器集合(GCC):链接选项 [ ^ ]。您需要-static-libgcc
和-static-libstdc ++
选项来包含静态库。
See Using the GNU Compiler Collection (GCC): Link Options[^]. You need the-static-libgcc
and-static-libstdc++
options to include the static libraries.
这篇关于如何静态链接到libc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文