xcode - xcrun clang --sysroot 找不到 stdio.h

标签 xcode clang xcrun

使用Xcode 4.6,在Mac OS X 10.8.2 下,为了编译hello.c,我发出了xcrun gcc cannot find header files 中推荐的xcrun 命令。但仍然收到无法找到头文件stdio.h 的错误。

 $ 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");
 }

最佳答案

它应该与:
xcrun clang -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/

关于xcode - xcrun clang --sysroot 找不到 stdio.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14903017/

相关文章:

ipa - xcrun命令导出iphoneos10.0的ipa文件xcode8

flutter - xcrun : error: invalid active developer path, problem after zsh update for flutter

ios - 如何为 iOS 应用程序的不同设备设置不同的启动文件(xib,而不是启动图像)

c - 标识符中的 Gdb 和美元

c++ - 有没有办法用 clang 在 VisitCallExpr 方法中获取 CallExpr* 的调用者?

xcode - 使用clang++ 4.2时,“选择的构造函数在复制初始化错误中是显式的”

iOS 代码覆盖率报告包含不应该存在的文件

ios - 引用 iOS 应用程序的 Xcode 项目中的目录

swift - UITableViewCell 创建

iphone - 如何在iOS中在PDF中绘制多种彩色文本?