我在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可以提供更详细的消息吗?感谢
不,相同的类在构建阶段没有被编译两次。
答案 0 :(得分:1)
您错误地将Cars class .m文件导入SpriteSlider.m文件。将其切换为“#import "Cars.h"
”即可完成设置。
欢迎你!