Apple Mach - o (id) error after adding a static library in xcode 4
I m facing the above stated error in my iPad app. I am adding a static library in my app using xcode 4 (via link binaries with libraries). When I bulid the app getting error like
ld: duplicate symbol _OBJC_METACLASS_$_Reachability in /Users/indiait-supportservices/Desktop/Universal/lib/simulator/libSecurLib.a(Reachability.o) and /Users/indiait-supportservices/Library/Developer/Xcode/DerivedData/ReceiverForiOS-avuvmyuaipqegxbkwsrfbymgadjj开发者_运维百科/Build/Intermediates/ReceiverForiOS.build/Debug-iphonesimulator/myApp iPad.build/Objects-normal/i386/Reachability.o for architecture i386 collect2: ld returned 1 exit status Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
I have added linker flag needed for that static library and also -all_load linker flag in "other linker fags" and also added all the necessary frameworks. And also there is no duplicate symbol used in my app. I tried using changing the compiler LLVM GCC 4.2 to GGC 4.2 (and all).I searched all the similar threads in stack overflow and tried all the solutions mentioned there.Still not able to solve the problem.Is that static library not linked properly? Is there any other way to add the library in xcode 4?
Can anyone plz help me??
Thank u...
If this isn't a problem with your build, then it appears that the problem is that you are both directly using Reachability and it is also being used by libSecurLib.a. If you remove the Reachability code (just the .m) from your project you should be able to build, but there is a possibility that the version of Reachability used in libSecurLib.a is different from the version your headers are using, so you might get other errors.
One way to work around this problem is to rename the version of Reachability that your project is including.
精彩评论