Error: Use of '@import' when C++ modules are disabled, consider using -fmodules and -fcxx-modules

Hello,

While attempting to add the AEPCore SDK to my iOS app, I encountered an issue preventing my iOS project from compiling:

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

My project is currently in the “bare” workflow after running prebuild from a previously managed-flow Expo project. Curiously, when installing the same dependency to a plain, vanilla react native project (without Expo), the project compiles successfully.

Anyone run into an issue like this before?

AppDelegate.h looks like so:

#import <RCTAppDelegate.h>
#import <UIKit/UIKit.h>
#import <Expo/Expo.h>

@import AEPCore;
@import AEPServices;
@import AEPLifecycle; 
@import AEPSignal; 
@import AEPEdge; 
@import AEPEdgeIdentity; 
@import AEPEdgeConsent; 

@interface AppDelegate : EXAppDelegateWrapper

@end

Okay, so as a workaround I discovered I can create a separate header file and an objective-c file to wrap the Adobe SDK setup, then import it into the main AppDelegate…

AdobeBridge.h:

#import <Foundation/Foundation.h>

@interface AdobeBridge : NSObject

+ (void)configureAnalytics;

@end

AdobeBridge.m:

#import "AdobeBridge.h"

@import AEPCore;

@implementation AdobeBridge

+ (void)configureAnalytics
{
  [AEPMobileCore configureWithAppId:@"app_id_here"];
}

@end

And in AppDelegate.mm:

  [super application:application didFinishLaunchingWithOptions:launchOptions];

  [AdobeBridge configureAnalytics];

  return YES;

Very strange that a direct reference does work for a vanilla react native project, but this extra step is required for react native with expo. This method works, but I would love to figure out why the normal process isn’t suitable here

Hi @joem-rp

Is it feasible to check for differences in the native projects created for the Expo app vs. the vanilla React Native app (e.g. using diff -urN expo-app/ios rn-app/ios)?

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.