问题
I have the following Xcode project dependencies:
A -> C
B -> C
When I build these separately, everything works fine.
However, I want to add A
and B
to the same Xcode project, creating the following dependency graph:
/ -> A -> C
D-<
\ -> B -> C
This causes duplicate symbol errors, and is basically DLL hell. What is a good way to resolve this while allowing the projects to be independent? I realize that I could break up A
and B
's dependency on C
, and then remake that dependency in D
, but I want A
and B
to be indpendently buildable.
回答1:
In A and B's project files, remove C from 'Link binary with libraries' while leaving it in target dependencies. This allows you to use C in A and B, but not to use C in D. To use C in D, add it directly to D (don't count on A or B passing it down).
来源:https://stackoverflow.com/questions/11784917/how-do-i-resolve-avoid-duplicate-symbols-in-common-transitive-xcode-dependencies