1

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
1
  • Do you have a symbol called pointOffsetArray (or something to that effect?) Can you provide the code for the declaration/definition? Commented Aug 26, 2011 at 18:16

2 Answers 2

2

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).

Sign up to request clarification or add additional context in comments.

2 Comments

resolved, thanks ... exactly what you described ... :) _pointerOffsetArray wasn't declared (at least i didn't find it) but i have been importing a header file in both files
You mean the symbol pointerOffsetArray is defined in two different files, not declared. extern int pointerOffsetArray; is a declaration, while int pointerOffsetArray; (at global scope) is a definition.
0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.