clang -rewrite-objc 编译OC文件

2018-07-19  本文已影响0人  molar

直接运行 clang -rewrite-objc xxxxx.m会报错。

解决方法:

clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk xxxxx.m

太长使用比较困难。

简化方法:

1、终端执行vim ./bash_profile

2、在vim界面输入i进去编辑模式 输入 alias rewriteoc = 'clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk xxxxx.m' 给编译命令起别名

3、ESC退出 :wq保存

4、source ./bash_profile 使别名生效

终端进入文件目录 执行rewriteoc xxxx.m  成功后目录中会出现xxxx.cpp文件

上一篇下一篇

猜你喜欢

热点阅读