duplicate symbol linker error due to libWeANDSFLib

2019-02-27 02:02发布

问题:

I am using ASI (ASIHTTPRequest, ASIDownloadCache, Reachability etc) request. Now in my project, I am using reachability.h and .m file.I have added one third party library and in that library I came to know that they are also using ASI library. But as per my knowledge they are using ASIReachability class instead of Reachability. So I added that .h file as well.

Still I am getting linker error which says :

duplicate symbol _kInternetConnection in:

    /Users/goutham.v/Library/Developer/Xcode/DerivedData/My_TWCable-fyaebjpvvaprmgdgtirhzshodpky/Build/Intermediates/My TWCable.build/Debug-iphonesimulator/My TWCable.build/Objects-normal/i386/Reachability.o
    /Users/goutham.v/Desktop/SVN/TWC_BC/12Mar2014_TWCBC/weandsf/iphonesimulator/libWeANDSFLibrary.a(ASIReachability.o)

duplicate symbol _kLocalWiFiConnection in:

    /Users/goutham.v/Library/Developer/Xcode/DerivedData/My_TWCable-fyaebjpvvaprmgdgtirhzshodpky/Build/Intermediates/My TWCable.build/Debug-iphonesimulator/My TWCable.build/Objects-normal/i386/Reachability.o
    /Users/goutham.v/Desktop/SVN/TWC_BC/12Mar2014_TWCBC/weandsf/iphonesimulator/libWeANDSFLibrary.a(ASIReachability.o)

duplicate symbol _kReachabilityChangedNotification in:

    /Users/goutham.v/Library/Developer/Xcode/DerivedData/My_TWCable-fyaebjpvvaprmgdgtirhzshodpky/Build/Intermediates/My TWCable.build/Debug-iphonesimulator/My TWCable.build/Objects-normal/i386/Reachability.o
    /Users/goutham.v/Desktop/SVN/TWC_BC/12Mar2014_TWCBC/weandsf/iphonesimulator/libWeANDSFLibrary.a(ASIReachability.o)
duplicate symbol _kConnectionDown in:

    /Users/goutham.v/Library/Developer/Xcode/DerivedData/My_TWCable-fyaebjpvvaprmgdgtirhzshodpky/Build/Intermediates/My TWCable.build/Debug-iphonesimulator/My TWCable.build/Objects-normal/i386/Reachability.o
    /Users/goutham.v/Desktop/SVN/TWC_BC/12Mar2014_TWCBC/weandsf/iphonesimulator/libWeANDSFLibrary.a(ASIReachability.o)
ld: 4 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please help me. Thanking you.

回答1:

You've receive duplicate symbol error. So you've to search this string _kConnectionDown, _kReachabilityChangedNotification, _kLocalWiFiConnection, _kInternetConnection, and remove duplication from files. I think, you may import Reachability class twice, one from libWeANDSFLibrary.a and another from ASI. Check this. Hope, help you.



回答2:

You may be included that files twice in your project so you should remove any one from the project its all because both getting compiled . Choose project--> go to Build Phases--> Type filename which showing it as error and check whether ho many files are there with same name and choose then remove any one from the list