Xcode "fails with exit code 1"

I'm new to xcode, 13 years old, and it stopped compiling my code! I'm working in C++ command line. My first project worked fine, but when I tried to run a new project, the build failed (not from syntax errors or anything) and gave me this notification:


Ld /Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfrsz qr/Build/Products/Debug/Test2 normal x86_64

cd /Users/cal/Documents/Application-Specific/XCode/Test2

setenv MACOSX_DEPLOYMENT_TARGET 10.7

/Developer/usr/bin/clang++ -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfr szqr/Build/Products/Debug -F/Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfr szqr/Build/Products/Debug -filelist /Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfrsz qr/Build/Intermediates/Test2.build/Debug/Test2.build/Objects-normal/x86_64/Test2 .LinkFileList -mmacosx-version-min=10.7 -o /Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfrsz qr/Build/Products/Debug/Test2


ld: duplicate symbol _main in /Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfrsz qr/Build/Intermediates/Test2.build/Debug/Test2.build/Objects-normal/x86_64/File. o and /Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfrsz qr/Build/Intermediates/Test2.build/Debug/Test2.build/Objects-normal/x86_64/Calcu lator.o for architecture x86_64

Command /Developer/usr/bin/clang++ failed with exit code 1


I bolded the part that seemed most important. Did it lose a file? Even my earlier project, which worked fine, won't run anymore.


Please respond, because I'm brand new and this means I can't code anymore.


Thanks!

iMac, Mac OS X (10.7), xcode 4.1 from Mac App Store

Posted on Aug 22, 2011 6:58 AM

Reply
3 replies

Aug 22, 2011 8:28 AM in response to SuperC23

This is the line that describes exactly what is wrong:


ld: duplicate symbol _main in /Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfrsz qr/Build/Intermediates/Test2.build/Debug/Test2.build/Objects-normal/x86_64/File . o and /Users/cal/Library/Developer/Xcode/DerivedData/Test2-dddrxmdmqydygiejxapflqfrsz qr/Build/Intermediates/Test2.build/Debug/Test2.build/Objects-normal/x86_64/Calc u lator.o for architecture x86_64


You have main defined in both 'File' and 'Calculator'.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Xcode "fails with exit code 1"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.