Xcode C++ 头文件目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28759427/
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
Xcode C++ Header Files Directory
提问by perhapsmaybeharry
I've been trawling the internet to no avail while trying to find an answer to where Xcode stores its C++ header (.h) files like "stdio.h" etc. I'm looking for the directory just out of curiousity.
我一直在互联网上搜索无果,试图找到 Xcode 存储其 C++ 标头 (.h) 文件(如“stdio.h”等)的位置的答案。我只是出于好奇在寻找该目录。
Thanks in advance! Harry
提前致谢!哈利
回答by WhozCraig
Standard library headers are spread across two primary locations, one of them highly dependent on the SDK choice you have for your project.
标准库头文件分布在两个主要位置,其中之一高度依赖于您为项目选择的 SDK。
For the regular C standard headers, you'll find them in the following location, assuming a regular install of Xcode:
对于常规的 C 标准头文件,您将在以下位置找到它们,假设 Xcode 的常规安装:
/Applications
/Xcode.app
/Contents
/Developer
/Platforms
/*ChosenTargetPlatform*
/Developer
/SDKs
/*ChosenMacOSSDK*
/usr
/include
where ChosenTargetPlatform
is one of :
其中ChosenTargetPlatform
之一是:
iPhoneOS.platform
iPhoneSimulator.platform
MacOSX.platform
and the ChosenMasOSSDK
is from whichever SDKs you have installed on your build rig and have chosen as the target OS. For example:
并且ChosenMasOSSDK
来自您在构建装备上安装并选择作为目标操作系统的任何 SDK。例如:
MacOS10.9.sdk
is for MavericksMacOS10.10.sdk
is for Yosemite
MacOS10.9.sdk
是给小牛队的MacOS10.10.sdk
是为优胜美地
etc...
等等...
The C++ standard library headers are a little different. They're stored independent of the MacOS SDK and target platform. The default location, again assuming you have a stock, run of the mill install:
C++ 标准库头文件有点不同。它们的存储独立于 MacOS SDK 和目标平台。再次假设您有库存,运行工厂安装的默认位置:
/Applications
/Xcode.app
/Contents
/Developer
/Toolchains
/XcodeDefault.xctoolchain
/usr
/include
/c++
/v1
The reason behind this (as near as I can see) is the C++ standard library is coupled together withthe formal toolchain itself. I.e. clang, c99, c11, etc, are all part of the formal toolchain including the headers andany required libs, executables, etc.
这背后的原因(据我所知)是 C++ 标准库与正式工具链本身耦合在一起。例如,clang、c99、c11 等都是正式工具链的一部分,包括头文件和任何所需的库、可执行文件等。
Most of this you can explore for yourself by doing the follow:
您可以通过执行以下操作自行探索其中的大部分内容:
- In a source file hover over the filename portion of a
#include<filename>
- Cmd-click the filename, it should open.
- From the File menu, select "Show in Finder"
- 在源文件中,将鼠标悬停在
#include<filename>
- Cmd-单击文件名,它应该打开。
- 从文件菜单中,选择“在 Finder 中显示”
That should open a Finder windows and allow you to explore the file's location. If you include the Path
button as one of the toolbar options in your Finder configuration it will reveal the full path of where you are.
这应该会打开一个 Finder 窗口并允许您浏览文件的位置。如果您将该Path
按钮作为 Finder 配置中的工具栏选项之一,它将显示您所在位置的完整路径。
Best of luck.
祝你好运。
回答by Sergio
For xCode 6 you can find that file here: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h
对于 xCode 6,您可以在此处找到该文件:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h