Duplicate symbols issue with 2 third party librari

2019-04-07 18:00发布

问题:

I'm trying to compile a project that depends on 2 third party static libraries.

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 Xcode but 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).

Thanks Rog

回答1:

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