alexpov
alexpov

Reputation: 1188

Xcode 4 - failed with exit code 1 error

I've seen several posts on this error, I've read all of them but with no success , I will be glad for a solution. Here is the output I recieve when compiling ...

ld: duplicate symbol _pointOffsetArray in /Users/admin/Library/Developer/Xcode/DerivedData/Display_Cubes_2-acsuoldwvhwsnjfowhhxfsmdeekc/Build/Intermediates/Display Cubes 2.build/Debug-iphonesimulator/Display Cubes 2.build/Objects-normal/i386/Display_Cubes_2ViewController.o and /Users/admin/Library/Developer/Xcode/DerivedData/Display_Cubes_2-acsuoldwvhwsnjfowhhxfsmdeekc/Build/Intermediates/Display Cubes 2.build/Debug-iphonesimulator/Display Cubes 2.build/Objects-normal/i386/Display_Cubes_2AppDelegate.o for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1

Upvotes: 1

Views: 1356

Answers (2)

Chaitanya Gupta
Chaitanya Gupta

Reputation: 4053

What it means is that you probably have a global symbol called _pointerOffsetArray (or something similar) defined in two different files. Look for all instances where this symbol is globally defined, and if you do find two different declarations:

  1. If they are needed only in their respective files, qualify them with static keyword.

  2. If the symbol needs to be "shared" between the two files, then make sure that it is defined at only one place. You can refer to it in the other file by using the extern qualifier to declare it (in this other file).

If you don't know already, you really should read up on how the extern and static qualifiers work.

In your case the symbol is probably defined twice in Display_Cubes_2ViewController.m or Display_Cubes_2AppDelegate.m (or, most likely, you are importing a header file in both of these files which defines this symbol).

Upvotes: 2

Reed Olsen
Reed Olsen

Reputation: 9169

I believe the duplicate symbols are in Display_Cubes_2ViewController and Display_Cubes_2AppDelegate. Try renaming them.

Additionally, you might want to try cleaning your build folder with

Command + Option + Shift + K

Although this may seem like a blanket solution, it's helped me solve some stupid compile issues in the past. Good luck!

Upvotes: 0

Related Questions