Quantcast
Viewing latest article 3
Browse Latest Browse All 13

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 

#include 
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$ 

Viewing latest article 3
Browse Latest Browse All 13

Trending Articles