默认库由GCC相连吗? [英] Default libraries linked in by gcc?
问题描述
比方说,我有一个非常简单的C文件(称为foo.c的):
Let's say I have a very simple C file (called foo.c):
int main()
{
printf("foo");
return 0;
}
现在我称之为海湾合作委员会:
Now I call gcc:
gcc foo.c
当我打电话GCC(不带任何选项,如上面的例子),什么库默认链接在和它们位于何处? (在Mac OS X 10.7)
When I call gcc (with no options, as in the above example), what libraries are linked in by default and where are they located? (On Mac OS X 10.7)
推荐答案
的 -v
选项 GCC
将导致其倾倒它会使用包括库路径和默认的库文件和目标文件将在被链接的默认选项的信息。
The -v
option to gcc
will cause it to dump information about the default options it will use including the library paths and default libraries and object files that will be linked in.
如果你给轮候册, - 详细
选项,GCC将通过 - 详细
来的连接器将转储它的确切位置在寻找库,包括失败和成功的搜索。
If you give the -Wl,--verbose
option, gcc will pass the --verbose
to the linker which will dump exactly where it's looking for libraries, including both failed and successful searches.
合并这两个选项,你会看到什么图书馆有联系,以及为什么他们在被链接。
Combine both options, and you'll see exactly what libraries are linked in, and why they're being linked in.
gcc -v foo.c -Wl,--verbose
这篇关于默认库由GCC相连吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!