我正在尝试使用 Xcode 创建一个程序。该程序非常简单,它使用线程。 我已经做对了一切。或者说我是这么想的。出现这个错误,我已经明白这意味着什么了!
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
连同:
ld: duplicate symbol _thr_inc_low in (... a bunch of crap that is the directory of this file) main.o
你能帮我吗?
最佳答案
这意味着您有多个包含符号 _thr_inc_low
的 .o
文件或库。
造成这种情况的常见原因之一是在头文件中定义一个包含在多个源文件中的对象(而不仅仅是声明它,例如使用 extern
或原型(prototype))。
如果不查看源代码的相关部分,就无法了解更多信息。
关于c - 用 C 编程时出现 Xcode 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7752646/