连接器命令,退出code 1未能在第X code [英] Linker command failed with exit code 1 In Xcode
问题描述
我在X $ C $写C C程序,而我得到了这个问题:
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.
推荐答案
一个常见的错误是的确定的在当你想要的声明一个头的象征的吧:
A common error is to define a symbol in a header when you wanted to declare it:
当你比如声明一个全局变量,而忘记了的extern
或你定义一个内联函数,而忘记了在线
。在这种情况下,编译器在每次编译单元,包括这个头的象征和你结束了一个符号的多个定义。
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.
这篇关于连接器命令,退出code 1未能在第X code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!