0

I have a problem with my project. when i build my project, i have an error. It shows duplicate symbol _sprites for _game

ld: 2 duplicate symbols for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Image for help

Kakshil Shah
  • 3,466
  • 1
  • 17
  • 31
user3243304
  • 53
  • 1
  • 7
  • 2
    Where in your code do you define sprites_for_game? (I'll guess you have a .h file that defines the variable instead of just declaring it and that you're including that .h in multiple places.) – Phillip Mills Jan 28 '14 at 14:52
  • Have you searched on-line or SO already? For instance: http://stackoverflow.com/questions/15584781/apple-o-mach-linker-error and http://stackoverflow.com/questions/10435213/linker-command-failed-with-exit-code-1-use-v-to-see-invocation?rq=1 – wmorrison365 Jan 28 '14 at 15:09
  • i define this variable in header helloworldlayer and use sprtes_for_game in helloworldlayer.mm – user3243304 Jan 28 '14 at 15:50
  • i did it by example http://www.spritehelper.org/app/SpriteHelper_API_Documentation/DocumentationCocos2d/ – user3243304 Jan 28 '14 at 16:05
  • Do you also include that header in AppDelegate and IntroLayer? Perhaps you could edit your question to include the code. – Phillip Mills Jan 28 '14 at 18:47

1 Answers1

0

I had this same error, it was because I defined a constant with the same name in two separate .m files. Once I changed the name in one of them, it compiled.

For example in my ViewController.m I had:

#import "ViewController.h"
const int IPHONE4 = 480;

and in my Menu.m:

#import "Menu.h"
const int IPHONE4 = 480;

I changed my Menu.m to:

#import "Menu.h"
const int IPHONE4H = 480;
Ali
  • 837
  • 7
  • 5