Reputation: 1073
This error happens when I try to import the file "VARendererViewController.h" from the file "VAMenuScreenViewController"
duplicate symbol _gestureMinimumTranslation in:
/Users/Sam/Library/Developer/Xcode/DerivedData/Virtual_Human_Avatar-fwgdkxpnkzapxrdzkggtmbnfhjwb/Build/Intermediates/Virtual Human Avatar.build/Debug-iphonesimulator/Virtual Human Avatar.build/Objects-normal/i386/VARendererViewController.o
/Users/Sam/Library/Developer/Xcode/DerivedData/Virtual_Human_Avatar-fwgdkxpnkzapxrdzkggtmbnfhjwb/Build/Intermediates/Virtual Human Avatar.build/Debug-iphonesimulator/Virtual Human Avatar.build/Objects-normal/i386/VAMenuScreenViewController.o
ld: 1 duplicate symbol for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Could anyone provide me with some
Upvotes: 0
Views: 1517
Reputation: 2643
The linker is trying to join a set of objects with a common symbol. This often happens when the Compile Sources
Build Phase
has duplicate entries or a header file. Try removing these.
Upvotes: 0
Reputation: 162712
You have two compilation units -- two source files -- that are defining the same symbol.
This may be because you defined the symbol in two separate .m files (or other compilation unit; .c, .mm, etc...) or because you defined the symbol in a header file and imported it into those two files. Alternatively, if you shove a variable declaration into a header file without the extern
, then it'll cause a symbol by that name to be created in every .m
file it is imported into.
Assuming gestureMinimumTranslation
is a variable, then if you really want a global variable, it should be defined in only one .m file as follows:
int gestureMinimumTranslation;
Then, in the corresponding header:
extern int gestureMinimumTranslation;
And the other .m
file should import the above header.
Upvotes: 4