5

With Xcode 4.6, under Mac OS X 10.8.2, to compile hello.c, I issued the xcrun command recommended in xcrun gcc cannot find header files but still received the error that the header file stdio.h can not be found.

 $ xcrun clang --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/ -o hello hello.c
 hello.c:2:10: fatal error: 'stdio.h' file not found
 #include <stdio.h>
     ^
 1 error generated.
 $ cat hello.c
 /* C program, Hello World */
 #include <stdio.h>
 int main()
 {
  printf("Hello World \n");
 }
Community
  • 1
  • 1
Greg Coats
  • 51
  • 1
  • 3

2 Answers2

2

it should work with : xcrun clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/

n80fr1n60
  • 681
  • 1
  • 6
  • 12
0

I changed my Build Settings for that project as the Base SDK was not specified. Once I changed it to OS X 10.7 (or whatever you are using should be fine), I was able to compile everything successfully without changing other build configurations.

Chef Pharaoh
  • 2,103
  • 3
  • 25
  • 36