ioscordovaduplicate-symbol

Duplicate Symbols IOS when sharing static Library on sub projects


I have a problem sharing a static library to my xcode sub projects. Assuming the structure of my project is like this:

Main.xcodeproj
|
|_Cordova.xcodeproj
|
|_SubProject1.xcodeproj
|
|_SubProject2.xcodeproj

I have create the static library for:

These libraries needs to be linked with the Cordova Static Library.

I've done this by:

then

After that,

If i build i obtain the following errors:

duplicate symbol _OBJC_IVAR_$_CDVViewController._commandQueue in:
    /Users/xxx/Library/Developer/Xcode/DerivedData/appxxx/Build/Products/Debug-iphonesimulator/libSubProject1.a(CDVViewController.o)
    /Users/xxx/Library/Developer/Xcode/DerivedData/appxxx/Build/Products/Debug-iphonesimulator/libSubProject2.a(CDVViewController.o)

duplicate symbol _OBJC_IVAR_$_CDVViewController._commandDelegate in:
    /Users/xxx/Library/Developer/Xcode/DerivedData/appxxx/Build/Products/Debug-iphonesimulator/libSubProject1.a(CDVViewController.o)
    /Users/xxx/Library/Developer/Xcode/DerivedData/appxxx/Build/Products/Debug-iphonesimulator/libSubProject2.a(CDVViewController.o)

How can I share this library across these two sub projects?

Thank you so much


Solution

  • There's no need to link both SubProjects with Cordova, you can just link the Main target to Cordova.