1 Reply
      Latest reply: Oct 18, 2016 1:29 AM by eskimo RSS
      ojas jain Level 1 Level 1 (0 points)

        how to compile the c program and what are the header files in xcode8

        • Re: how to compile
          eskimo Apple Staff Apple Staff (6,470 points)

          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:

          #import <Foundation/Foundation.h>

          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:

          #include <stdio.h>

          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"