问题
I'm building an ARC iphone app, and about to integrate the addThis ios library.
I get the following error:
ld: duplicate symbol _OBJC_CLASS_$_Facebook in /Users/mars/Desktop/Pst/trunk/Pst/ThirdPartyLibs/FBConnect/FacebookSDK/FacebookSDK.framework/FacebookSDK(Facebook.o) and /Users/mars/Library/Developer/Xcode/DerivedData/Pst-bqmphjiqldalzsankfvxugsurcdj/Build/Intermediates/Pst.build/Debug-iphonesimulator/Pst.build/Objects-normal/i386/Facebook.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've double checked with my Compile Resource, and only 1 facebook.m is present.
I've also put "-fno-objc-arc" in my compiler flags for those library files because they are built without ARC
Any help would be really appreciated!!
回答1:
I've got the same error when followed the instruction to drag ThirdPartyLibs to my project. It had added both FBConnect and FacebookSDK to my project.
If you open the AddThisDemo project, which comes with the library, you will see that only FacebookSDK and DeprecatedHeaders were added (not entire FBConnect). I have recreated this structure in my project and that had solved my issue.
Hope that helps!
回答2:
For anyone with this issue but these answers are not helping: if you created one custom class and called it Facebook.h/.m, just change its name and after it, no more linkage errors.
回答3:
You have a #import "facebook.m"
in one of your files where you should have put #import "facebook.h"
.
来源:https://stackoverflow.com/questions/12352267/duplicate-symbol-objc-class-facebook