在目标C中结合__cplusplus使用@import [英] Using @import in objective C in conjunction with __cplusplus

查看:198
本文介绍了在目标C中结合__cplusplus使用@import的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试编译链接到使用新的@import指令的文件的Objective C ++文件(.mm)时,我遇到了一些错误。目前,我唯一的解决方案是用旧的#import指令替换@import。

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.

还有其他解决方案,所以我仍然可以使用@import吗?

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

推荐答案

修改
根据最新文档,这应该可行。

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

请参阅。您必须使用 -fcxx-modules 标志而不是 -fmodules 标志,但正如官方文档所示 - 实验和非常突破。我根本无法让它工作......在我看来,最好坚持使用 #import #include 直到该功能超出 experimental 阶段。

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.

来自 clang.llvm.org

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

这篇关于在目标C中结合__cplusplus使用@import的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆