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

1

5

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.

Decimeter answered 2/8, 2012 at 20:3 Comment(0)
S
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).

Sorrows answered 2/8, 2012 at 23:46 Comment(1)
But then, I can't build and use A or B independently. Consumers of A or B need to know to add C as a dependency.Decimeter

© 2022 - 2024 — McMap. All rights reserved.