安装新的xcode 4.3后找不到stdio.h

Leo*_*ard 5 xcode xcode4.3

升级到Lion后,安装XCode 4.3我无法编译"Hello,World".

include <stdio.h>

int
main ( int argc, char *argv[]) {

    printf("Hello, World!\n");
}


$ gcc hello.c 
hello.c:1:19: error: stdio.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我在./SDKs/MacOSX10.6.sdk/usr/include/stdio.h中看到了一个stdio.h,但是有一点令人惊讶的是没有10.7版本.我的安装失败了吗?它报告了成功.

在谷歌搜索之后,这个问题的标准解决方案是重新安装XCode.但XCode是通过App商店提供的,并没有给我重新安装选项.我也从未见过其他地方引用的其他各种选项,如"Unix开发".

想法?

Leo*_*ard 8

事实证明,解决方案是下载"命令行工具"包.下载后,运行包安装程序,一切顺利./ Developer目录已过时,不再在Xcode 4.3中使用

苹果开发者网站是我的朋友


Jef*_*ine 6

从Xcode 4.3中,打开"首选项"并选择" 下载"图标.在" 组件"窗格中,您可以安装" 命令行工具 ".

安装完成后,在终端中运行以下命令:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/
Run Code Online (Sandbox Code Playgroud)

那为我排序了.

[更新] - 我只需要在我的笔记本电脑上再次这样做,我不需要安装命令行工具.升级到Xcode 4.3后,运行xcode-select就足以让命令行构建再次运行.