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
In my case I needed to use OpenCV in my application.
I have solved this problem by adding
-fcxx-modules
(Objective C++) manually to "Other C++ Flags"
(Build Settings/ Apple Clang - Custom Compiler Flags/ Other C++ Flags)
or
-fmodules
(Objective C) to "Other C Flags"
(Build Settings/ Apple Clang - Custom Compiler Flags/ Other C Flags)
And also I needed to put import the opencv.hpp
before any Apple's headers to fix errors of Expected identifier in opencv library.
For example in Prefix.pch
I organized it that way:
#ifdef __cplusplus
#include
#endif
#import
I am using: