Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Command /Developer/usr/bin/gcc-4.2 failed with exit code 1?

Hey everybody!

Im new to xcode and dont have any coding experience but am trying to learn the basics by assembling and compiling a calculator app. The problem is when I try to build and run I get the error:

Command /Developer/usr/bin/gcc-4.2 failed with exit code 1


The debug looks like this


Build calc of project calc with configuration Debug

Ld build/Debug/calc.app/Contents/MacOS/calc normal x86_64
cd "/~xcode projects~/calculator/calc"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/gcc-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk "-L/~xcode projects~/calculator/calc/build/Debug" "-F/~xcode projects~/calculator/calc/build/Debug" -filelist "/~xcode projects~/calculator/calc/build/calc.build/Debug/calc.build/Objects-normal/x86_ 64/calc.LinkFileList" -mmacosx-version-min=10.6 -framework Cocoa -o "/~xcode projects~/calculator/calc/build/Debug/calc.app/Contents/MacOS/calc"

ld: duplicate symbol _OBJC_IVAR_$_CalcController.calc_display in /~xcode projects~/calculator/calc/build/calc.build/Debug/calc.build/Objects-normal/x86_ 64/CalcController-7806DEC6D5FE0A8E.o and /~xcode projects~/calculator/calc/build/calc.build/Debug/calc.build/Objects-normal/x86_ 64/CalcController-C97DF742AA7918D.o
collect2: ld returned 1 exit status
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1


Im a big newbie here and would greatly appreciate any help offered.

Thanks!

MB, Mac OS X (10.5.2)

Posted on May 6, 2010 4:09 PM

Reply
3 replies

May 7, 2010 2:30 PM in response to jerryfan23

jerryfan23 wrote:
ld: duplicate symbol _OBJC_IVAR_$_CalcController.calc_display in /~xcode projects~/calculator/calc/build/calc.build/Debug/calc.build/Objects-normal/x86_ 64/CalcController-7806DEC6D5FE0A8E.o and /~xcode projects~/calculator/calc/build/calc.build/Debug/calc.build/Objects-normal/x86_ 64/CalcController-C97DF742AA7918D.o


How many places do you declare calc_display? Are you perhaps creating the variable in an include file? Try posting your code here between two lines of :

Command /Developer/usr/bin/gcc-4.2 failed 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 ID.