Duplicate symbol: Include static lib A in static lib B, also include lib A and B in XCode Project

后端 未结 2 1846
逝去的感伤
逝去的感伤 2020-12-31 11:23

I\'ve been trying to build up a set of reusable libraries for app development, but I\'m starting to run into a problem.

One of my static libs is a set of general use

相关标签:
2条回答
  • 2020-12-31 12:00

    Although Lib B depends on Lib A you don't actually want to put all the objects from A into B which is what you've done by the looks of it. I'm not sure how you managed that but I would imagine when you built Lib B you linked against Lib A? If so, just omit Lib A from the build line for Lib B. All the symbols from Lib A are meant to be undefined in Lib B.

    Static libraries are just archives of object files so the two should be completely separate. When you need to link against Lib B just specify Lib A as well.

    0 讨论(0)
  • 2020-12-31 12:06

    This thread discussed removing the duplicates using commandline tools.

    How to handle duplicate symbol error from 3rd party libraries?

    They extracted the .o files inside .a files and removed the duplicates then combined again.

    0 讨论(0)
提交回复
热议问题