默认库由GCC相连吗? [英] Default libraries linked in by gcc?

查看:107
本文介绍了默认库由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屋!

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