ld: duplicate symbol _velocityX in \
/Users/Student/Library/Developer/Xcode/DerivedData/finalproject-ffzevekmatxvhrgisgeleoijyllr/Build/Intermediates/finalproject.build/Debug-iphonesimulator/finalproject.build/Objects-normal/i386/Level2ViewController.o \
and \
/Users/Student/Library/Developer/Xcode/DerivedData/finalproject-ffzevekmatxvhrgisgeleoijyllr/Build/Intermediates/finalproject.build/Debug-iphonesimulator/finalproject.build/Objects-normal/i386/Level1ViewController.o \
for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
UPDATE: added \ + newlines for readability
I have no clue what is wrong with my project, can anyone help?
Well, it means we're trying to link the same symbol name (in our case, a method) from two (or more) different source files. The fix was easy: rename one of the methods by updating the header file, the source file (. c or .
Duplicate symbols occur when you have both added an implementation file (. cpp) to your project and #included it. This way, the implementation file (. cpp) gets compiled twice: once as a module in your project (as it is added to your project) and subsequently as a piece of #included code.
clang: error: linker command failed with exit code 1 (open frameworks) exitCode1. This means you have two files which have a function called "main" in them -- the compiler compiles all the code fine, but when it goes to link, it sees two object symbols that have the same name.
I had this same error, it was because I defined a constant with the same name in two separate .m files. Once I changed the name in one of them, it compiled.
For example in my ViewController.m I had:
#import "ViewController.h"
const int IPHONE4 = 480;
and in my Menu.m:
#import "Menu.h"
const int IPHONE4 = 480;
I changed my Menu.m to:
#import "Menu.h"
const int IPHONE4H = 480;
I had same problem. But it was my fault. :). You might have writen a #import file.m
instead of #import file.h
. So Compiles Resource will duplicate symbol file.o.
- That's it! ^^ To see it, You remove that error file, build --> Show error row --> then recopy it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With