Header files not found on Mac

Discussion in 'Mac Programming' started by gladif, Nov 2, 2013.

  1. gladif macrumors newbie

    Nov 2, 2013
    I have a piece of code in C with header files included.
    I run it on Mac OS X Maverick with XCode 4.6.2 installed. GCC is also installed. Note that Command Line Tools in XCode are already installed.

    When I compile it, the error I receive says something like this:
    add.c:1:19: error: stdio.h: No such file or directory
    add.c:2:20: error: stdlib.h: No such file or directory
    add.c:3:20: error: unistd.h: No such file or directory

    However when I run it on Ubuntu, it compiles without a problem.

    what to do?
  2. mrichmon macrumors 6502a

    Jun 17, 2003
    Mavericks with XCode in some cases does not setup the correct path to the active developer tools. You can correct this by running the following command at a Terminal prompt:

    xcode-select install
    Then try compiling your code using gcc on the command-line.

Share This Page