Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ld: xx duplicate symbols for architecture armv7 Xcode Project

Hi everybody I have a Xcode project that gives me this error every time I try to build the project:

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

I have googled around and most solutions say to get rid of duplicate files in the build phase->Compile Resources section of the project or to change the import .m to .h in some files. Problem is the list of compiled resources isn't even sorted and I do not even know which files to fix since there are a lot of files in my project. Any advice on how on how to clean this up?

like image 769
Meeko Avatar asked Aug 04 '14 16:08

Meeko


2 Answers

I have had this error sometimes, and the issue is always this. I have a static variable in the .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, whether in different files or not. So check for any duplicate static variable names or #define macros. Also, it might not be duplicate 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 can't figure out which one to use. The conflicting variables should be in the files mentioned in the error. Hope this helps!

like image 77
Adam Evans Avatar answered Nov 12 '22 05:11

Adam Evans


There are certain Files in your project which may have been imported twice, try to analyse the error log, it must be referring the file where somewhere you must be getting an error as "YourViewCOntroller.O" its finding the double files,search for "YourViewCOntroller" in your project navigator, You need to remove these files from your Xcode project and then build again

like image 4
Geet Avatar answered Nov 12 '22 05:11

Geet