0

I have these messages on Xcode

duplicate symbol _OBJC_IVAR_$_Cars._color in:
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._brand in:
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._place in:
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_IVAR_$_Cars._state in:
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_CLASS_$_Cars in:
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
duplicate symbol _OBJC_METACLASS_$_Cars in:
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/Cars.o
    /Users/myUsername/Library/Developer/Xcode/DerivedData/myApp-ecspkaggqtvfeuglkpunmntelswf/Build/Intermediates/myApp.build/Debug-iphoneos/myApp.build/Objects-normal/armv7/SpriteSlider.o
ld: 6 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The duplicate symbols it mentions are not duplicate. These are four properties declared in my Cars class like this:

@property (nonatomic, copy) void (^color)();
@property (nonatomic, copy) void (^brand)(Cars *oneCar, NSSet *touches);
@property (nonatomic, strong) NSString *place;
@property (nonatomic, assign) NSString *state;

The other class SpriteSlider does not have these properties. How can it be duplicate?

How do I discover the problem. Can Xcode give more detailed messages? Thanks

NO, the same classes are not being compiled twice in the build phases.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Duck
  • 34,902
  • 47
  • 248
  • 470
  • 2
    How are you importing your Cars class header file into your SpriteSlider .m or .h file? – Michael Dautermann Sep 14 '13 at 04:42
  • It's complaining about the variables, not the properties. It's also complaining about the `Cars` class. Somehow you seem to be creating two `Cars` classes. Double check your `SpriteSlider.h` and `SpriteSlider.m` files. – rmaddy Sep 14 '13 at 04:44
  • Michael, you are a genius. I havetyped #import "Cars.m" by mistake !!!! Please make this comment an answer, so I can accept that!!!!!! Thanks. – Duck Sep 14 '13 at 04:45

1 Answers1

1

You're importing your Cars class .m file into your SpriteSlider.m file by mistake. Switch it to "#import "Cars.h"" and you'll be all set.

And you're welcome!

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215