Did a search for this question and could not find much help.
"could not build module 'Foundation'"
#import < Foundation/Foundation.h>
Not certain what is the problem. Thank you for any advice.
Did a search for this question and could not find much help.
"could not build module 'Foundation'"
#import < Foundation/Foundation.h>
Not certain what is the problem. Thank you for any advice.
I was able to solve this using the solution provided in this Apple Support Communities thread:
The real problem here is at Build Settings in the session: Apple LLVM 5.0 - Language - Modules, we should set Enable Modules (C and Objective C) to NO
I found that if you use some external c / c++ code in your project, you have to remove all the #import in prefix. that's quite headache but it's a true problem
Cmd+Option+Shift+k then Cmd+Option+k solved above error for me.
you can try this
in your .pch file
write like this
#ifndef PureStandard_PrefixHeader_pch
#define PureStandard_PrefixHeader_pch
#ifdef __OBJC__
#import "A.h"
#import "B.h"
#endif
#endif
The suggested fix to set Enable Modules (C and Objective-C)
did not solve this issue for me.
What did is renaming my someFile.c
files to someFile.m
. Even though those files contain just C functions (that do use Foundation types), naming them .c
produces this error.
I have resolved by change Build System to Legacy Build System
Open the ios/PROJECT_NAME.workspace file
Then in the top menu select File > Workspace Settings
Then change Build System to Legacy Build System
If using flutter run flutter clean
in terminal or in android studio, restart emulator and run app.
Just rename your Objective-C++ file from *.c
to *.mm
.
The errors are gone that way, it handles all the imports just fine this way.