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?
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.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:
and in my Menu.m:
I changed my Menu.m to:
I ran into this same error while trying to integrate a few frameworks into my app.
First I was using Sparrow - a graphics library, and by default I had a main.m file, things were fine until I tried to integrate Parse which also depended on the FacebookSDK. Within the FacebookSDK folders there is a Sample app called Scrumptious with a main.m as well which was the source of my problems. I removed the sample apps directory and everything built fine.
You probably have
double _velocityX
in a header file included by bothLevel1ViewController.c
andLevel2ViewController.c
, when the header should haveextern double _velocityX
, and exactly one of the.c
files should havedouble _velocityX
. (Assuming the type of_velocityX
isdouble
, which seemed reasonable, and also assuming this is either C or C++ and not Fortran or something).