OC转c++

作者: 开心一刻_ | 来源:发表于2018-08-13 11:09 被阅读0次
    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
    

    相关文章

      网友评论

          本文标题:OC转c++

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