how to compile the c program
What sort of C program? If you’re writing code from scratch — say you want to build and run a ‘hello world’ program as part of learning C — you should start with a project created from the macOS > Command Line Tool template. From there you should be able to build and run using all the standard Xcode GUI features.
If you’re starting from some other place, the best approach depends on your specific needs. Please clarify.
and what are the header files in xcode8
Xcode collects headers, stub libraries and a bunch of other stuff into platform SDKs, which are included within Xcode. If you install Xcode in
/Applications/the path to the macOS platform SDK is
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/. In there you’ll find
usr/include/, with standard C headers, and
System/Library/Frameworks/, containing a bunch of frameworks, each of which has its own headers.
However, most of the time you don’t need to use these paths. Rather, if you set up your project in Xcode, it will take care of finding headers for you. For example, a project created with the above-mentioned Command Line Tool template includes the line:
which will import the Foundation framework headers from the macOS SDK without any special work on your part. Similarly, you could add a line like this:
to get at standard C headers.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"