问题
I'm using Layar Player in my app.
It provides a static library to include in your project.
After installing and trying to compile, I got this error:
ld: duplicate symbol _OBJC_CLASS_$_Reachability in //LayarPlayer/Debug/liblayarplayer.a(Reachability.o) and //MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/Reachability.o for architecture armv7
I'm using Reachability in my app to check network status, but it seems like it's already included in the library.
I've tried removing every #import Reachability in my code, but obviously I get "undeclared function" errors.
How can I solve this?
回答1:
You need to delete the references from the project. That means don't delete the #import Reachability
but search for Reachability.m
and Reachability.h
in your project files and delete them so you only have one of each in your project.
回答2:
I excluded all conflicting .m files from the target and everything is fine now.
Headers files must not be deleted.
回答3:
I solved this same problem by
- check your project remove duplicate Reachability file;
- replacing old version of Reachability(I'm currently using version 2.2);
- put the -ObjC -all_load linker flags on.
Hope it may help.
来源:https://stackoverflow.com/questions/6725008/conflict-between-class-and-static-library