问题
I'm writing C program in Xcode, and I got this problem:
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea to solve it?
Note: I've just update my OS to Mountain Lion yesterday.
回答1:
A common error is to define a symbol in a header when you wanted to declare it:
When you for instance declare a global variable and forget the extern
or you define an inline function and forget the inline
. In these cases the compiler emits the symbol in each compile unit that includes this header and you end up with multiple definitions of a symbol.
Anyway you should just look for the symbol in question.
来源:https://stackoverflow.com/questions/11704448/linker-command-failed-with-exit-code-1-in-xcode