Make Xcode 3.2.6 gcc work

Apple did something smart around Xcode 3.2.6 – probably to make it easy to configure gcc to use different SDKs. But, before figuring out what happened, it just brakes your compiler. With Xcode 3.2.6 (and maybe later versions):

sleipnir:~ gt$ cat hello.c 

int main() {
    printf("Hello world\n");

sleipnir:~ gt$ gcc -o hello hello.c
-bash: gcc: command not found
sleipnir:~ gt$ PATH=/Developer/usr/bin/:$PATH
sleipnir:~ gt$ gcc -o hello hello.c
hello.c:2:19: error: stdio.h: No such file or directory
hello.c: In function ‘main’:
hello.c:4: warning: incompatible implicit declaration of built-in function ‘printf’
sleipnir:~ gt$ gcc --sysroot /Developer/SDKs/MacOSX10.6.sdk  -o hello hello.c
sleipnir:~ gt$ 

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.