How to deal with mutil-cross static library in one iPhone project
I got a prob that, I have a base static library "Base", then other 2 libs("A" & "B") depend on it. So then I have a project "P", I add the 3 libs to "P", I get an error:
ld: duplicate symbol .objc_category_name_NSObject_IMIBase in
/Users/Travis/Documents/Home/IMI/IMIKit/build/Debug-iphonesimulator/libIMIUI-iphonesimulator.a(IMIBaseNSObjectHelper.o) and
/Users/Travis/Documents/开发者_运维技巧Home/IMI/IMIKit/build/Debug-iphonesimulator/libIMIData-iphonesimulator.a(IMIBaseNSObjectHelper.o)
So, how can I deal with this kind of relationship of the libs with project.
Thank you very much!
You need to build A and B without including Base library symbols in it. When archiving A and B (running ar), ensure you are not adding the objects files of Base in them. You can verify that with the command nm, it must read U next to the the base symbols names.
Also ensure your Base library has "extern" declarations.
精彩评论