I am getting this error suddenly when running my app via iPhone simulator:
clang: error: linker command failed with exit code 1 (use -v to see invocation):
ld: duplicate symbol _OBJC_CLASS_$_Algebra5FirstViewController in .../Algebra5-anwcuftojtxtgkfootneeeqhwztj/Build/Intermediates/Algebra5.build/Debug-iphonesimulator/Algebra5.build/Objects-normal/i386/ExercisesViewController.o and .../Algebra5-anwcuftojtxtgkfootneeeqhwztj/Build/Intermediates/Algebra5.build/Debug-iphonesimulator/PSLE Algebra5.build/Objects-normal/i386/PSLE_Algebra5FirstViewController.o for architecture i386
What is it all about?
I was getting similar error and I got it resolved this way.
This occurred for me when I named a UILabel reference and an int the same thing, I didn't get an error when I typed it only when I tried to run it so I didn't realize that that was the problem, but if you have something like a label which is the "score" and you call it score, and name an int which is the score also score then this problem occurs.
I got this issue because I accidentally imported the .m instead of the .h. Hope reading this saves someone with same problem some time.
[XCODE 7.1 UPDATE]
First Option That Worked:
I changed the
Deployment Target
from 7.1 to 8.1 and the error went away.Hope that helps someone.
UPDATE (day 2): Second time I'm back here in 2 days.
On day 2 I started to get more errors in addition to this annoying error. The problem was a conflicting file that Xcode didn't recognize. I used the links below as help:
"_OBJC_CLASS_$_viewsampleViewController", referenced from:
‘ld: warning: directory not found for option’
And ultimately:
I was deleting everything from the
FrameWork Search Paths
+Compile Resources
+Run Script Phases
+ the pods and then re-installing them again to ultimately find success.The issue on my size (on day 2) was more of a problem with conflicting files or files that Xcode didn't recognize.
But ultimately, removing everything (mentioned above and in the links), cleaning a lot of times and reinstalling the pods/frameworks/run script phases helped.
Really hope this helps someone.
In one case, I saw this error when dragging a new class' .h and .m into the project. The only solution I found was to remove the references to these files and then add them back via the project menu.
'linker command failed with exit code 1 (use -v to see invocation)'- I got this error when running a phonegap application on iPhone. I changed Build Active Architecture Only to Yes and it worked fine.