Domanda

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.

È stato utile?

Soluzione

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!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top