use of '@import' when c++ modules are disabled, consider using -fmodules and -fcxx-modules
Asked Answered
P

3

6

This came up for me when I tried to integrate AdMob using Cocoapods into an Objective C++ project.

use of '@import' when c++ modules are disabled, consider using -fmodules and -fcxx-modules

What is this error and how do I fix it?

Pentarchy answered 28/12, 2020 at 17:28 Comment(0)
P
6

Fix is easy, you have to do what the warning says and not only enable C and Objective-C modules but also C++ modules.

So you must add the compiler flag -fcxx-modules to "Other C++ Flags" in your Build Settings

Pentarchy answered 28/12, 2020 at 17:28 Comment(0)
A
0

Try this:

  1. Open Build Settings tab under TARGETS
  2. Search GCC_INPUT_FILETYPE
  3. Check the value of Compile Sources, change the value to According to File Type if it's not
Acarology answered 20/2, 2023 at 9:42 Comment(0)
E
0

Follow these steps :-

  1. Search in build setting "apple clang - custom"
  2. In other C++ flags
  3. Add "-fcxx-modules" in Debug and Release.
  4. Clean and Build.

screenshot to show exact change

Elane answered 6/8 at 10:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.