Xcrun clang --sysroot cannot find stdio.h

With Xcode 4.6, on Mac OS X 10.8.2, to compile hello.c, I issued the xcrun command recommended in xcrun gcc, I can't find the header files , but still got the error that the stdio.h header file was not 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");
 }

      

+3


source to share


2 answers


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



+1


source


I changed mine Build Settings

for this project as Base SDK

it was not listed. 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 any other build configurations.



0


source







All Articles