Question

It seems that some of my Mac OS X systems have /usr/include/mach-o/loader.h and others don't. I'm confused because this file is documented here:

https://developer.apple.com/library/mac/#documentation/developertools/conceptual/MachORuntime/Reference/reference.html

For example:

...Declared in /usr/include/mach-o/loader.h. See also mach_header_64.

Does anyone know if this file was removed on any newer versions of Mac OS X? Or if I need to install a special SDK to get it?

Was it helpful?

Solution

It exists on my Mac (OS X 10.7), but I do have Xcode installed and it might have come as part of that.

Edit

Note that when Xcode compiles anything, it doesn't use the headers in /usr/include but the ones in the SDK you have chosen and you can find out where the system headers are by doing a compile and then checking the -isysroot command line switch. So I have just done a compile and the compiler invocation includes:

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7sdk

If you open that directory, you'll find it contains a usr/include/mach-o subdirectory with the file you want in it.

OTHER TIPS

loader.h is a hidden file on MAC, so if you don't have hidden files viewable open up a terminal first do this command:

defaults write com.apple.finder AppleShowAllFiles TRUE

then this command:

killall Finder

After that follow the path in the finder: /usr/include/mach-o/loader.h

If you do have hidden files all I can say is that I have a OS X 10.7, 10.6 and 10.5 laptop and they have it and have Xcode installed to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top