Modern version of Xcode don’t use headers from the system, that is, in
/usr/include/
. Rather, Xcode picks up headers from the SDK built in to Xcode. For example, when you include
<netdb.h>
in a Mac project you actually get
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h
(assuming Xcode is installed in the standard place).
This is further complicated by the fact that kernel development doesn’t use the standard headers at all. Rather, all kernel headers are packaged inside the
Kernel
[pseudo-]framework. So, for example,
<kern/kern_types.h>
actually resolves to
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/kern/kern_types.h
.
If you’re building kernel code and Xcode is not finding
<kern/kern_types.h>
, the most likely problem is that Xcode doesn’t know that you’re building kernel code. The necessary flags get automatically configured when you create a kernel target, so my best guess is that you’re trying to build kernel code in a non-kernel target.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"