clang編譯的兩種方法
1.使用絕對路徑:
clang -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk xx/xx/y.m(文件的絕對路徑)
通過上述命令即可編譯通過
2.修改全局變量
vim ~/.bash_profile
在終端輸入i鍵入
alias rewriteoc='clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'
點擊esc返回輸入:wq退出
終端再次輸入 source ~/.bash_profile 環境變量生效
再次編譯成C++代碼
只需要輸入 rewriteoc + 文件的絕對路徑