Compilation error with C++ compiler
alois-beto opened this issue ยท 7 comments
Summary
The compilation fails when using an AppDelegate
in ObjC++
Reproduction steps
- Create an
AppDelegate
in ObjC++ (AppDelegate.mm
) - Install Batch SDK with Cocoapods
- Compile the app
Logs
This is the error: Definition of type 'NSUInteger' conflicts with typedef of the same name
on this line:
Complete error:
While building module 'Batch' imported from /Users/aguichard/Documents/cleo-app/ios/Pods/Headers/Public/RNBatchPush/RNBatch.h:13:
In file included from <module-includes>:1:
In file included from /Users/aguichard/Library/Developer/Xcode/DerivedData/biogen-cguhdlivievnsvhfvvmdytvcmpok/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/Batch/Batch.framework/Headers/Batch.h:25:
/Users/aguichard/Library/Developer/Xcode/DerivedData/biogen-cguhdlivievnsvhfvvmdytvcmpok/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/Batch/Batch.framework/Headers/BatchMessagingModels.h:11:14: error: definition of type 'NSUInteger' conflicts with typedef of the same name
typedef enum NSUInteger {
^
In module 'Foundation' imported from /Users/aguichard/Library/Developer/Xcode/DerivedData/biogen-cguhdlivievnsvhfvvmdytvcmpok/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/Batch/Batch.framework/Headers/Batch.h:9:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
In module 'os_object' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/usr/include/dispatch/dispatch.h:63:
In module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/usr/include/os/object.h:111:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/usr/include/objc/./NSObjCRuntime.h:13:23: note: 'NSUInteger' declared here
typedef unsigned long NSUInteger;
^
1 error generated.
Specifications
SDK Version
v1.19.0
Installation method
Cocoapods
Relevant development tools versions
XCode 13.3.1
Additional information
This issue does not appear when using a regular AppDelegate in ObjC (.m
)
Hi!
Thanks for your detailed report! It being so complete helps us a lot.
While we reproduce this, can you try patching this locally in the headers, in your Cocoapods checkout folder?
Replace
typedef enum NSUInteger {
...
} BatchMessagingContentType;
with
typedef NS_ENUM(NSUInteger, BatchMessagingContentType) {
...
};
haven't had the time to test it on my end yet, but this should not be an api breaking change and should compile in C++ mode
Thank you for your quick response, I already tested your solution, it is working fine ๐
I opened #30 with the fix
Thanks. Unfortunately I will not be able to merge the PR per our policy (also as we develop the SDK in a private fork and do source drops)
I'll apply this change on our dev branch!
Misclick, I'll close this once the fix is released
Perfect
As RN depends of this and doesn't explicitly support 1.19 yet, we're considering backporting this to 1.18
This fix has been released in 1.18.2 & 1.19.1, out today!
Thanks for reporting it.