在常见的Xcode依赖关系中如何解决避免重复的符号? [英] How do I resolve avoid duplicate symbols in common transitive Xcode dependencies?
问题描述
我有以下Xcode项目依赖关系:
I have the following Xcode project dependencies:
A -> C
B -> C
当我单独构建这些内容时,一切正常。
When I build these separately, everything works fine.
但是,我想将 A
和 B
添加到同一个Xcode项目中,创建以下依赖关系图:
However, I want to add A
and B
to the same Xcode project, creating the following dependency graph:
/ -> A -> C
D-<
\ -> B -> C
这会导致重复的符号错误,基本上是DLL的地狱。什么是一个很好的方法来解决这个问题,同时允许项目独立?我意识到我可以分解 A
和 B
依赖于 C
,然后在 D
中重写依赖关系,但是我想要 A
和
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.
推荐答案
在A和B的项目文件中,从链接中删除C二进制与库,而将其保留在目标依赖关系中。这样可以在A和B中使用C,但不要在D中使用C。要在D中使用C,请将其直接添加到D(不要指望A或B将其传递下来)。
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).
这篇关于在常见的Xcode依赖关系中如何解决避免重复的符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!