Xcode - 命令/Developer/usr/bin/clang 失败,退出代码为 1 [英] Xcode - Command /Developer/usr/bin/clang failed with exit code 1
问题描述
我刚刚开始编程,并尝试学习 C.
I'm just starting programming, and trying to learn C.
对于我的家庭作业,我必须设计一个程序,而且我很确定我的代码是正确的,但是每当我尝试测试它,甚至直接尝试书中的程序时,我都会收到此错误.
For my homework I had to design a program, and I'm pretty sure my code is right, but whenever I try to test it, or even try programs directly from the book, I get this error.
Ld "/Users/BasirJamil/Library/Developer/Xcode/DerivedData/Lab_2-fuyrgmtkjwgafzctwttcpwxptwox/Build/Products/Debug/Lab 2.app/Contents/MacOS/Lab 2" normal x86_64
cd "/Users/BasirJamil/Desktop/Lab 2"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/BasirJamil/Library/Developer/Xcode/DerivedData/Lab_2-fuyrgmtkjwgafzctwttcpwxptwox/Build/Products/Debug -F/Users/BasirJamil/Library/Developer/Xcode/DerivedData/Lab_2-fuyrgmtkjwgafzctwttcpwxptwox/Build/Products/Debug -filelist "/Users/BasirJamil/Library/Developer/Xcode/DerivedData/Lab_2-fuyrgmtkjwgafzctwttcpwxptwox/Build/Intermediates/Lab 2.build/Debug/Lab 2.build/Objects-normal/x86_64/Lab 2.LinkFileList" -mmacosx-version-min=10.7 -framework Cocoa -o "/Users/BasirJamil/Library/Developer/Xcode/DerivedData/Lab_2-fuyrgmtkjwgafzctwttcpwxptwox/Build/Products/Debug/Lab 2.app/Contents/MacOS/Lab 2"
ld: duplicate symbol _main in /Users/BasirJamil/Library/Developer/Xcode/DerivedData/Lab_2-fuyrgmtkjwgafzctwttcpwxptwox/Build/Intermediates/Lab 2.build/Debug/Lab 2.build/Objects-normal/x86_64/File.o and /Users/BasirJamil/Library/Developer/Xcode/DerivedData/Lab_2-fuyrgmtkjwgafzctwttcpwxptwox/Build/Intermediates/Lab 2.build/Debug/Lab 2.build/Objects-normal/x86_64/main.o for architecture x86_64
Command /Developer/usr/bin/clang failed with exit code 1
有人可以解释一下问题是什么,以及我如何解决它,而不会过于技术化(如果可能的话)?记住,我还是个编程新手
Can somebody please explain what the problem is, and how I can fix it, without getting overly technical (if possible)? Remember, I'm still new to programming
提前致谢
推荐答案
ld: duplicate symbol _main in /Users/BasirJamil/Library/Developer/Xcode/DerivedData/Lab_2
您不止一次定义了一个变量(很可能)或一个函数.事实上,可能你已经定义了两次 _main
.
You have a variable (most likely) or a function defined more than once. In fact, it may be that you have defined _main
twice.
它有助于阅读整个错误消息,而不仅仅是最后一行.:-)
It helps to read the whole error message, not just the last line. :-)
检查您的代码.
这篇关于Xcode - 命令/Developer/usr/bin/clang 失败,退出代码为 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!