Xcode modules are included in the settings, but still cannot use @import

In the settings "Enable modules" is set to "Yes":

Enable Modules

And yet I still get the error message: "Using" @import "when modules are disabled."

Mistake

This is a project that I am updating to use modules, not a new project (works fine in a new project).

Are there conditions under which Xcode returns to enabled instead of using modules?

+8
objective-c xcode
source share
1 answer

One place in which modules are not available is in the Objective-C ++ code ( .mm file extension), which is noticeable for projects that communicate between C / C ++ and Objective-C.

If you use the @import syntax in the Objective-C ++ file, you get the same error you reported ("Using" @import "when modules are disabled").

Clang docs say:

There is currently no C or C ++ syntax for import declarations. Clang will track the offer of modules in the C ++ committee.

which I consider a reference to this inaccessibility.

+16
source share

All Articles