直接運行?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、終端執(zhí)行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 使別名生效
終端進入文件目錄 執(zhí)行rewriteoc xxxx.m? 成功后目錄中會出現(xiàn)xxxx.cpp文件