@import error in iOS project with .mm extension file

I am trying to integrate to iOS framework to Unity project as a plugin. I follow this tutorial.

My problem is when my project has .mm file for bridging between iOS and Unity, I have error like

"Use of @import when C++ modules are disabled"
etc. in normal .m file.

If I delete .mm file, all errors disappeared.

All errors are shown in the following image


https://www.dropbox.com/s/ui3tk3es7v3ost6/Screen%20Shot%202017-11-29%20at%2022.21.04.png?dl=0


Here is some discussion for that, but I can't find

Enable the modules

in my XCode's

Build Settings
. My XCode is 8.3.3.

Some people say to enable -fcxx-modules flag, but where can I enable the flag in XCode?


How can I solve the error?

Accepted Reply

C++ does not currently support modules, and

@import
relies on module support. To import a framework from C++ you’ll have to do it old school, using
#include
. So, replace this:
@import MyFancyFramework;

with

#include <MyFancyFramework/MyFancyFramework.h>

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

C++ does not currently support modules, and

@import
relies on module support. To import a framework from C++ you’ll have to do it old school, using
#include
. So, replace this:
@import MyFancyFramework;

with

#include <MyFancyFramework/MyFancyFramework.h>

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"