How do I resolve avoid duplicate symbols in common transitive Xcode dependencies?

不羁的心 提交于 2019-12-07 15:18:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!