Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Use of '@import' when modules are disabled" Error - Enable Modules & Link Frameworks = YES

I have a project that uses CocoaPods and uses the 'SCLAlertView-Objective-C' pod. That pod uses the @import UIKit; module style import. I've set "Enable Modules (C & Objective-C)" and the "Link Frameworks Automatically" to YES in both my target and project settings. I am still getting the "Use of '@import' when modules are disabled" error.

Is there anything that could prevent Xcode from being able to enable Modules such as the use of a .pch file, any linker flags, or anything else I haven't mentioned? I also tried to clean the project and the project build folder. That didn't have any effect.

Also worth noting is that my project has multiple targets and also has a deployment target of iOS 7.0. My Base SDK is set to iOS 8.3.

Screenshot of target build settings for modules

like image 522
socaljoker Avatar asked May 21 '15 20:05

socaljoker


1 Answers

I guess your project contains XXX.mm files, however, the xcode only enable C and objective-c modules.

Please have a look at this answer for your reference: Using @import in objective C in conjunction with __cplusplus

my solution is modify the @import xxx into #import .

Good luck.

like image 110
user3510132 Avatar answered Oct 19 '22 05:10

user3510132