如何使用clang -rewrite-objc
指令查看c++源码?
由于直接使用-rewrite-objc xxx.m是会产生异常的,如果想正常使用可以使用如下指令:
//原始指令
clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk xxxxx.m
当然,你也可以通过alias进行快捷指令定义,操作如下:
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’3、键入完毕,点esc退出编辑状态,再键入:wq退出vim并保存,执行source ~/.bash_profile<-这句一定要执行,执行才会生效
接下来可以到工程的main路径下执行:rewriteoc main.m就可以看到效果了;