6.3.1 clang 编译 main.m 是不是我系统有问题.提示找不到头文件.求解谢谢

clang -arch arm64 -isysroot ‘xcrun --sdk iphoneos --show-sdk-path’ -framework Foundation -o MainBinary main.m

clang -arch arm64 -isysroot ‘xcrun --sdk iphoneos --show-sdk-path’ -o MainBinary main.m

两个命令都试过就是提示
main.m:1:10: fatal error: ‘stdio.h’ file not found
#include <stdio.h>
^
1 error generated.

提示找不到 stdio.h .查看了系统文件也存在啊

真的晕了不知道哪里出了问题望指点.谢谢了

 'xcrun xxxxx' -> `xcrun xxxx`

' -> `

clang -arch armv7 -isysroot ‘xcrun --sdk iphoneos --show-sdk-path’ -o MainBinary main.m
改成下面这样?
clang -arch armv7 -isysroot ‘xcrun --sdk iphoneos --show-sdk-path’ -o MainBinary main.m
还是不行.改了以后如下图

$(xcrun --sdk iphoneos --show-sdk-path)

改成xxxxxx 变成报这个错误

Bash下面单引号的意思是指把里面的内容当作文本来对待
$() 类似php的eval

clang -arch armv7s -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -o MainBinary main.m
Undefined symbols for architecture armv7s:
  "_NSLog", referenced from:
      _TestFunction0 in main-9557eb.o
      _TestFunction1 in main-9557eb.o
      _TestFunction2 in main-9557eb.o
      _TestFunction3 in main-9557eb.o
  "___CFConstantStringClassReference", referenced from:
      CFString in main-9557eb.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

然后我搞了个空文件还是提示错误

clang -arch armv7s -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -o MainBinary 123.m
Undefined symbols for architecture armv7s:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

是不是我的 xcode 又问题. 你可知道是什么问题. 知道请指点一下.不胜感激.谢谢

你的文件名又不是123.m照抄我的指令干啥

你可能需要手动链接CoreFoundation

说真的你为啥不用theos的tool模版要自己手写

我这边是Xcode8.3.2

我看书上的,按照书上的来的.我的 xcode7.31.好多坑

我还真没研究过linker这边的实现。群里找我我们试试?

我才看了两天书,我不在群里面.方便告诉我群号是多少吗?

Aug 31, '15 3:37 AM

百度网盘-链接不存在 文件不存在被删除了

这不是你自己2年前发的帖子么

anyway群号在这里 http://bbs.iosre.com/t/ios-qq/8891/9

哦,忘记了.后来一直没有时间学习.最近刚好有时间才拿起书来慢慢啃.:innocent:

目前我建议先用theos的tool模版绕过这一块。反正刚上手早期我觉得也没啥必要直接操作clang