Xcode 中 2 个第三方库的重复符号问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12829564/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Duplicate symbols issue with 2 third party libraries in Xcode
提问by Rog
I'm trying to compile a project that depends on 2 third party static libraries.
我正在尝试编译一个依赖于 2 个第三方静态库的项目。
The issue is that both third parties have included the same set of "utility" classes in their static library distribution, meaning that I am getting dozens of duplicate symbol errors when both are added to my project.
问题是,这两个第三方都在他们的静态库分发中包含了相同的一组“实用程序”类,这意味着当两者都添加到我的项目中时,我会收到数十个重复的符号错误。
Is there a way for me to force the project to compile and/or ignore one of the duplicate symbols somehow?
有没有办法强制项目以某种方式编译和/或忽略其中一个重复符号?
I found a similar question with answer here two static libraries with duplicate symbols in Xcodebut I am interested to see if there is a compiler flag that might do the trick (please note that in this case I am assuming that both symbols represent the same object).
我发现了一个类似的问题,这里有两个在 Xcode 中有重复符号的静态库,但我有兴趣看看是否有一个编译器标志可以解决这个问题(请注意,在这种情况下,我假设两个符号代表同一个对象)。
Thanks Rog
谢谢罗格
回答by Orange
Try merge them into one file via libtool (libtool -o merged.a file1.a file2.a) or check How can I avoid “duplicate symbol” errors in xcode with shared static libraries?or/and Solving “Duplicate Symbol” Error When Setting Up GorillaLogic's FoneMonkey 5
尝试通过 libtool (libtool -o merge.a file1.a file2.a) 将它们合并到一个文件中或检查如何使用共享静态库避免 xcode 中的“重复符号”错误?或/和在设置 GorillaLogic 的 FoneMonkey 5 时解决“重复符号”错误
回答by picacode
Just find the duplicate symbol file and rename one of the library corresponding files. Be aware that you should check all compiled sources of the project that you are renaming. Xcode won't change the references automatically.
只需找到重复的符号文件并重命名库对应文件之一。请注意,您应该检查要重命名的项目的所有编译源。Xcode 不会自动更改引用。