Ld: xx duplicate characters for armv7 architecture Xcode Project

Hi everyone, I have an Xcode project that gives me this error every time I try to build a project:

ld: xx duplicate characters for armv7 architecture Xcode Project clang: error: linker command ended with exit code 1 ...

I have googled around, and most solutions say to get rid of duplicate files in the build phase-> Compile Resources project or change the import of .m to .h in some files. The problem is that the list of compiled resources is not even sorted, and I don’t even know which files to fix, since there are a lot of files in my project. Any tips on how to clean them?

+6
source share
3 answers

I had this error sometimes, and the problem is always that. I have a static variable in .m of one class and another static variable with the same name in another .m. Apparently, the compiler does not like it when there are two static variables with the same name, regardless of whether they are in different files or not. Therefore, check for duplicate static variable names or #define macros. In addition, this may not be a duplicate of files or files imported twice. If two different files are imported, but each has a variable or macro with the same name, there will be an error because the compiler cannot figure out which one to use. Conflicting variables must be in the files mentioned in the error. Hope this helps!

+6
source

Your project has certain files that may have been imported twice, try to analyze the error log, it should refer to a file, somewhere you should get an error message like "YourViewCOntroller.O", search for duplicate files, find "YourViewCOntroller" in your project navigator, you need to delete these files from the Xcode project, and then create it again

+4
source

If you use Cocoapods like me, you may find that other answers do not help, because duplicates are generated automatically by the pod file.

What worked for me was to look at a list of duplicate characters, for example:

duplicate character _OBJC_METACLASS _ $ _ AFImageCache in:

___ / Construction / Products / Debug-iphoneos / libPods-AFNetworking.a (UIImageView + AFNetworking.o)

___ / Build / Products / Debug-iphoneos / libAFNetworking.a (UIImageView + AFNetworking.o)

ld: 214 duplicate characters for armv7 architecture clang: error: linker command did not work with exit code 1 (use -v to call the call)

Then go to your project / goal Build Settings β†’ Other linker flags and remove the link to the duplicated block (in my case, AFNetworking).

Clean, re-create and it should work.

-

As far as I can tell, this can happen because one of the other blocks refers to AFNetworking, which leads to duplication.

0
source

Source: https://habr.com/ru/post/973330/


All Articles