Mihai Popa Mihai Popa - 5 months ago 46
iOS Question

Using @import in objective C in conjunction with __cplusplus

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?

Answer Source

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:

    Enable the modules feature for C++ (EXPERIMENTAL and VERY BROKEN).
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download