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

后端 未结 2 1863
逝去的感伤
逝去的感伤 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.

提交回复
热议问题