clang -rewrite-objc main.m
报错
9:9: fatal error: 'UIKit/UIKit.h' file not found
解决方法:
clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk ViewController.m
永久解决办法
$vim ~/.bash_profile
$alias rewriteoc=‘clang -x objective-c -rewrite-objc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk’
$source ~/.bash_profile
增加weak还可以转换c++的解决办法
clang -rewrite-objc -fobjc-arc -stdlib=libc++ -fobjc-runtime=macosx-11.0 -Wno-deprecated-declarations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk ViewController.m
网友评论