请问standardlibs的GCC -nostdlib prevent明确追加? [英] Does gcc -nostdlib prevent explicit appending of standardlibs?

查看:190
本文介绍了请问standardlibs的GCC -nostdlib prevent明确追加?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我称之为海湾合作委员会与链接器选项 -nostdlib 这并覆盖任何手动/ standardlibs明确appendecis?

If I call the GCC Linker with the option -nostdlib does this override any manual/explicit appendecis of standardlibs?

GCC是MinGW的4.8.1。

GCC is 4.8.1 from MinGW.

例如:

gcc -nostdlib [MyObjectsAndLibraries] -lmsvcrt -o Outfile

由于 libmsvcrt 是一个标准库,将它添加到链接过程中还是会被忽略?我无法找到任何可靠的数据在此,这就是为什么我也要AP preciate某种源这一点。

Since libmsvcrt is a standard library, will it be added to the link process or will it be ignored? I can't find any reliable data on this., this is why I would also appreciate some kind of source to this.

推荐答案

在此背景下,标准库是指库的gcc 将通过隐含的默认链接。在命令行中明确地提到库将被链接。事实上,在的 GCC 文档http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Link-Options.html#链接选项相对=nofollow> http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Link-Options.html#Link-Options 甚至指出,除非你真的知道你在做什么,你应该明确地添加时使用 -lgcc -nostdlib ,因为编译器会依靠一些它内建定义的:

In this context, "standard libraries" means the libraries that gcc would implicitely link by default. Libraries explicitely mentioned on the command line will always be linked. In fact, gcc documentation at http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Link-Options.html#Link-Options even points out that unless you really know what you're doing you should add explicitely -lgcc when using -nostdlib, as the compiler may rely on some builtins defined in it:

在换句话说,当您指定-nostdlib或-nodefaultlibs通常应指定-lgcc为好。这可确保您有内部GCC子程序库未解析引用。

In other words, when you specify -nostdlib or -nodefaultlibs you should usually specify -lgcc as well. This ensures that you have no unresolved references to internal GCC library subroutines.

这篇关于请问standardlibs的GCC -nostdlib prevent明确追加?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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