I can't build with core data - getting duplicate symbols for architecture x86_64

Hello


I am adding core data to an existing project that doesn't currently have it. I created the Data Model and added one entity with attributes. When I right click on "Editor/Create NSManagedObject Subclass" it creates 4 files - EntityName+CoreDataClass.h, .m and EntityName+CoreDataProperties.h and .m. The build fails with an error "2 duplicate symbols for architecture x86_64. I can build without subclassing the entity.


Can someone please help! I have spent many hours trying to figure this out.



duplicate symbol _OBJC_CLASS_$_CDEntityName in:

/Users/xxxx/Library/Developer/Xcode/DerivedData/AppName-dosiheqvgdthmcafbbeqlrylwxft/Build/Intermediates/AppName.build/Debug-iphonesimulator/AppName.build/Objects-normal/x86_64/CDEntityName+CoreDataClass.o

duplicate symbol _OBJC_METACLASS_$_CDEntityName in:

/Users/xxxx/Library/Developer/Xcode/DerivedData/AppName-dosiheqvgdthmcafbbeqlrylwxft/Build/Intermediates/AppName.build/Debug-iphonesimulator/AppName.build/Objects-normal/x86_64/CDEntityName+CoreDataClass.o

ld: 2 duplicate symbols for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Ultimately I just removed the references to EntityName.CoreDataClass.h and .m. and kept the +CoreDataProperties files.


It seems to work but I am not sure if this is the best method.

I have the same problem. But my duplicate symbols are on variables "int". Can anyone help?

I can't build with core data - getting duplicate symbols for architecture x86_64
 
 
Q