2

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
  • Ideas to solve it: 1) if it tells you which symbol is duplicated, find out why there are multiple definitions. 2) if it doesn't, or you can't figure it out, post the code and the compiler and link commands Commented Jul 28, 2012 at 20:37

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.