Jef
Jef

Reputation: 869

Cocos2dx Firebase CPP without Pod Integration

I want to integrate Cocos2dx v4 cpp project with Firebase (I am using firebase_cpp_sdk_8.11.0). This has been successfully integrated in Android. The problem that I am facing right now is integrate with IOS (without Pod). I already followed this link https://medium.com/firebase-developers/how-to-use-firebase-in-ios-games-written-in-c-fef1a6a9f87d and official Google Firebase tutorial but still failed.

The step that I did was:

  1. Create a new project Cocos2dx with command
cocos new CocosFirebase -p <com.your_company.your_game> -l cpp -d .
  1. Download the firebase_cpp_sdk and put inside the folder (follow the tutorial made a folder third_party). Modify the CMakeLists.txt and add this code below
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/firebase_cpp_sdk)
target_link_libraries(${APP_NAME}
    firebase_analytics
    firebase_messaging
    firebase_app
)
  1. Run the cmake and try to build the project (inside the Xcode is also can). Without section 2 above, the project can be built successfully. With Firebase code in CMakeLists.txt, it failed with error below (error build both in simulator or product any ios device arm64 amv7).
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FIROptions", referenced from:
      objc-class-ref in libfirebase_app.a(app_ios.mm.o)
  "_OBJC_CLASS_$_FIRConfiguration", referenced from:
      objc-class-ref in libfirebase_app.a(app_ios.mm.o)
  "_OBJC_CLASS_$_UNUserNotificationCenter", referenced from:
      objc-class-ref in libfirebase_messaging.a(messaging.mm.o)
  "_OBJC_CLASS_$_FIRApp", referenced from:
      objc-class-ref in libfirebase_app.a(app_ios.mm.o)
  "_OBJC_CLASS_$_FIRMessaging", referenced from:
      objc-class-ref in libfirebase_messaging.a(messaging.mm.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I also tried to link the library needed as stated in here Firebase Undefined symbols for architecture x86_64 but no luck. Or tried also to link directly inside the xcframework that provided from firebase cpp sdk.

Please note that I have successfully integrate with Android, and due to complexity and issue with Pod, I would like to integrate directly since Firebase also provide CPP SDK.

Any help will be much appreciated. Thanks.

Upvotes: 0

Views: 221

Answers (1)

R. Rouvin
R. Rouvin

Reputation: 1

I have exactly the same issue with my project using the Qt framework.

It looks like you're only using the firebase-cpp SDK.

This issue seems to be relative : https://github.com/firebase/firebase-cpp-sdk/issues/19

You might miss the native FirebaseIOS libs which the firebase-cpp-sdk wraps: https://firebase.google.com/download/ios

Upvotes: 0

Related Questions