美文网首页
Objective-C编译成C++代码报错(ViewContro

Objective-C编译成C++代码报错(ViewContro

作者: 金字塔的AI | 来源:发表于2018-12-06 10:50 被阅读30次

错误一:In file includedfromViewController.m:9:**./ViewController.h:9:9: ****fatal error: ****'UIKit/UIKit.h'filenotfound**#import <UIKit/UIKit.h>** ^**1error generated.

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<-这句一定要执行,执行才会生效

错误二: 'UIWebView' is unavailable: not available on macOS

解决办法:

指定真机

xcrun -sdk iphoneos clang -rewrite-objc ViewController.m

指定模拟器

xcrun -sdk iphonesimulator clang -rewrite-objc ViewController.m

指定SDK版本

xcrun -sdk iphonesimulator10.3 clang -rewrite-objc ViewController.m

Ç语言转C ++

    zhangquaniMac:~ zq$ cd /Users/zq/Desktop/Test/Test

    zhangquaniMac:Test zq$ clang -rewrite-objc main.c

参考:

HTTPS://cotin.tech/iOS/clang-rewrite-objc/

https://blog.csdn.net/qq_34003239/article/details/84230019

https://www.jianshu.com/p/43a09727eb2c

相关文章

网友评论

      本文标题:Objective-C编译成C++代码报错(ViewContro

      本文链接:https://www.haomeiwen.com/subject/xkmncqtx.html