macos 构建 C++ 应用程序时,OSX 系统包含文件的默认路径是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6715454/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:10:27  来源:igfitidea点击:

What is the default path for OSX system include files when building a C++ application?

c++macos

提问by Dan Nissenbaum

I am building a C++ application at the command line (using makewith an open-source library (Xerces 2.8)). One of the files includes an OSX system file,

我正在命令行构建 C++ 应用程序(使用make开源库 (Xerces 2.8))。其中一个文件包括一个 OSX 系统文件,

#include <TextUtils.h>

When I type make -nto determine the command used to compile the given file, there is no include path for the system framework files provided. Therefore, I assume that on OSX the gcc compiler looks in a default location for system include files.

当我键入make -n以确定用于编译给定文件的命令时,提供的系统框架文件没有包含路径。因此,我假设在 OSX 上,gcc 编译器会在系统包含文件的默认位置查找。

I would like to know what this location is. When I search for TextUtils.h, I see many versions of the file in different locations, including a few different possible candidates for what might be a default location.

我想知道这个位置是什么。当我搜索 时TextUtils.h,我会在不同位置看到该文件的许多版本,其中包括一些可能是默认位置的不同候选位置。

How can I determine the default path the system uses for system include files?

如何确定系统用于系统包含文件的默认路径?

回答by Eelke

Executing the following command

执行以下命令

# echo "" | gcc -xc - -v -E

will output the buildin configuration of gcc among which are the default includes.

将输出 gcc 的内置配置,其中默认包含。