/usr/include中的mach headers和SDK中的有什么区别?
What is the difference between the mach headers in /usr/include and the ones in the SDK?
在 MacOS X 中,Mach 内核 headers 位于
/usr/include/mach
和
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach
这些 headers 不匹配:它们提供不同的 API(功能、类型等)。
- 它们有什么区别?
- 我应该什么时候使用哪个?
What is the difference between them:
首先介绍一下 usr 文件夹的上下文:
/usr
包含 non-essential command-line 二进制文件、库、header 文件和其他非系统关键数据(意味着系统无需这些文件即可重新启动)。此文件夹是UNIX-specific目录,已被OS X继承。
/usr/include
编译用户 space 源代码所需的 'header files' 目录。
在终端中输入 man hier
,这将为您提供文件系统层次结构和每个目录的描述。
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
较新版本的 Xcode 不再使用来自“/usr/include/”的 header。相反,Xcode 使用嵌入在其包中的 SDK 中的 headers。
Why are they different?
这是因为它们几乎肯定是不同的版本,都来自不同的安装源,所以它们相同的可能性很小。
When should I use which?
这个答案确实取决于您要做什么?
如果您在 Xcode 中开发,您应该使用 Xcode 包 SDK,否则如果您在 Xcode 之外开发,请使用 /usr/include/。
来源:
来自Apple's documentation for the Kernel framework:
The Kernel Framework provides the APIs and support for kernel-resident device drivers and other kernel extensions.
如果这不是您正在编写的程序,那么您不应该使用它(包括它的头文件)。
在 MacOS X 中,Mach 内核 headers 位于
/usr/include/mach
和/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/mach
这些 headers 不匹配:它们提供不同的 API(功能、类型等)。
- 它们有什么区别?
- 我应该什么时候使用哪个?
What is the difference between them:
首先介绍一下 usr 文件夹的上下文:
/usr
包含 non-essential command-line 二进制文件、库、header 文件和其他非系统关键数据(意味着系统无需这些文件即可重新启动)。此文件夹是UNIX-specific目录,已被OS X继承。
/usr/include
编译用户 space 源代码所需的 'header files' 目录。
在终端中输入 man hier
,这将为您提供文件系统层次结构和每个目录的描述。
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
较新版本的 Xcode 不再使用来自“/usr/include/”的 header。相反,Xcode 使用嵌入在其包中的 SDK 中的 headers。
Why are they different?
这是因为它们几乎肯定是不同的版本,都来自不同的安装源,所以它们相同的可能性很小。
When should I use which?
这个答案确实取决于您要做什么?
如果您在 Xcode 中开发,您应该使用 Xcode 包 SDK,否则如果您在 Xcode 之外开发,请使用 /usr/include/。
来源:
来自Apple's documentation for the Kernel framework:
The Kernel Framework provides the APIs and support for kernel-resident device drivers and other kernel extensions.
如果这不是您正在编写的程序,那么您不应该使用它(包括它的头文件)。