0

我在 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)

它提到的重复符号不是重复的。这些是在我的 Cars 类中声明的四个属性,如下所示:

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

另一个类 SpriteSlider 没有这些属性。怎么可能重复?

我如何发现问题。Xcode 可以给出更详细的消息吗?谢谢

不,相同的类在构建阶段不会被编译两次。

4

1 回答 1

1

您错误地将 Cars 类 .m 文件导入 SpriteSlider.m 文件。将其切换为“ #import "Cars.h"”,您将一切就绪。

不客气!

于 2013-09-14T05:03:39.207 回答