查看默认包括`GCC -v`在Mac OS X的C头文件的路径? [英] View default include path of C headers in Mac OS X by `gcc -v`?

查看:3808
本文介绍了查看默认包括`GCC -v`在Mac OS X的C头文件的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到默认包含在Mac OS X(小牛)C编译器的路径,通过使用的gcc -v

I tried to find the default include path of the C compiler in Mac OS X (Mavericks) by using gcc -v:

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

这似乎告诉我路径<$c$c>/Applications/X$c$c.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1,但恐怕这是不是真正的路径。我认为包括标准C库中的真实路径<$c$c>/Applications/X$c$c.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include因为&LT; SYS / syscall.h&GT; 定位在后来的路径,这是<$c$c>/Applications/X$c$c.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/syscall.h

It seems to tell me the path is /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1, but I'm afraid it is not the true path. I think the true path for including standard C library is /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include because <sys/syscall.h> locates in the later path, which is /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/sys/syscall.h

有没有人有关于如何查看所有默认的想法包括在Mac OS X C库的路径?

Does anyone have ideas about how to view all the default include path of C library in Mac OS X?

推荐答案

您需要询问的 preprocessor ​​的,不是的的gcc 的,告诉默认包含路径

You need to ask the preprocessor, not gcc, for telling the default include path.

您可以说:

`gcc -print-prog-name=cc1` -v

为了列出包括默认为C和C ++路径:

In order to list default include path for both C and C++:

`gcc -print-prog-name=cc1plus` -v

(即路径的你已经列出以上是用于的配置的一个,同时建立海合会)。

(The path that you've listed above is the one that was used to configure GCC while building.)

另一种方式列出默认包含路径将是:

Another way to list the default include path would be:

gcc -x c -v -E /dev/null

gcc -x c++ -v -E /dev/null     # (for C/C++)

这篇关于查看默认包括`GCC -v`在Mac OS X的C头文件的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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