TeamStar TeamStar - 2 months ago 30
Objective-C Question

linker command failed with exit code 1 (use -v to see invocation)

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

ld: duplicate symbol _OBJC_CLASS_$_Algebra5FirstViewController in
for architecture i386

What is it all about?


It look like the class Algebra5FirstViewController is compile multiple time.

Can you make sure that the .m and .mm is only included once in your project sources in Xcode? You can also confirm this by checking in the compile log (last icon at the right, next to the breakpoints icon) and see that confirm that it is only compiled once.

Also, if this class is part of a library that you link against and you have a class with the same name, you could have the same error.

Finally, you can try a clean and rebuild, just in case the old object files are still present and there is some junk in the compiled files. Just in case...


I also note that the second reference is made in the file for ExercisesViewController. Maybe there is something in this file. Either you #imported the Algebra5FirstViewController file instead of the .h, or the ExercisesViewController has @implementation (Algebra5FirstViewController) instead of @implementation (ExercisesViewController), or there was some junk with this file that will cleaned with a Clean an Rebuild.