Using @import in objective C in conjunction with __cplusplus

我的未来我决定 提交于 2019-11-29 13:10:57

问题


When I try to compile an Objective C++ file (.mm) that is linked to a file that uses the new @import directive, I get some errors. Currently, my only solution is to replace the @import with the old #import directive.

Is there any other solution so I can still use @import?


回答1:


Edit: According to the latest docs this should work now.

See this. You have to use the -fcxx-modules flag instead of the -fmodules flag, but as the official documentation suggests - EXPERIMENTAL and VERY BROKEN. I didn't manage to get it working at all... In my opinion it's better to stick with #import and #include until that feature is out of experimental stage.

From clang.llvm.org:

-fcxx-modules
    Enable the modules feature for C++ (EXPERIMENTAL and VERY BROKEN).


来源:https://stackoverflow.com/questions/20708262/using-import-in-objective-c-in-conjunction-with-cplusplus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!