0

i create a new project with single page application, then i removed ViewController.h and .m file also deleted my story boards because i wanted to make a new class with UITableView subclass, after i build new storyBoard and changed the Main storyboard file base name in info.plist file to the new storyboard then i've got this error:

Apple Mach-O Linker Error Group clang: error: linker command failed with exit code 1 (use -v to see invocation)

enter image description here

can anyone help me with it?

i figured out something, when i create NSManagedSubclass from my .xcdatamodeld core data file, it make 4 sub class for each entity like the pictur below:

enter image description here

and thats where the problem will create, i read that the problem is dublicate file, maybe duplicate #import syntax, i dont know how to fix this i tried to fix it by put the 2 .h file for each entity together but it didnt work and i've got more errors, so i appreciate if you guys help me.

this is the log:

duplicate symbol _OBJC_CLASS_$_Note in: /Users/arashafshar/Library/Developer/Xcode/DerivedData/To_Dooz-eixtgqgyctrejleziaoxshnkdnym/Build/Intermediates/To Dooz.build/Debug-iphonesimulator/To Dooz.build/Objects-normal/x86_64/Note+CoreDataClass.o duplicate symbol _OBJC_METACLASS_$_Note in: /Users/arashafshar/Library/Developer/Xcode/DerivedData/To_Dooz-eixtgqgyctrejleziaoxshnkdnym/Build/Intermediates/To Dooz.build/Debug-iphonesimulator/To Dooz.build/Objects-normal/x86_64/Note+CoreDataClass.o duplicate symbol _OBJC_CLASS_$_Setting in: /Users/arashafshar/Library/Developer/Xcode/DerivedData/To_Dooz-eixtgqgyctrejleziaoxshnkdnym/Build/Intermediates/To Dooz.build/Debug-iphonesimulator/To Dooz.build/Objects-normal/x86_64/Setting+CoreDataClass.o duplicate symbol _OBJC_METACLASS_$_Setting in: /Users/arashafshar/Library/Developer/Xcode/DerivedData/To_Dooz-eixtgqgyctrejleziaoxshnkdnym/Build/Intermediates/To Dooz.build/Debug-iphonesimulator/To Dooz.build/Objects-normal/x86_64/Setting+CoreDataClass.o ld: 4 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Arash Afsharpour
  • 1,282
  • 11
  • 22

3 Answers3

1

Follow carefully the instructions in this Technical Q&A. I think you might have not done step 2 in the first figure, where you need to select "Manual/None" in the "Codegen" dropdown.

phi
  • 10,634
  • 6
  • 53
  • 88
  • finally FIXED, THANKS it was the Manual/None option i didnt know about that, i watched core data course from Lynda its for 2012 too old, it didn't say anything about this option and also when he create a NSObject he only had 2 file for each entity, 1 .h and 1 .m file, anyway my problem is gone, thanks to you. – Arash Afsharpour Jul 25 '17 at 14:01
0

Below solutions might work.

  1. Try to find if there is any place where you have imported .m instead of .h file

  2. if you are using cocoa pods then open .xcworkspace instead of .xcodeproj file

Here are some useful links for this kind of errors

Apple Mach-O Linker & Ditto Error - Xcode 8

Apple Mach-O Linker Error when compiling for device

pkallu
  • 86
  • 8
  • still nothing, i tried the steps they gave in those links, non of them work, my project is with Objective C not swift, with core data checkbox on, in learning course of lynda when he create new NSManagedSubclass from my .xcdatamodeld core data file there's only 2 file for each entity, 1 .h and 1 .m file when i do it it make 4 file for each entity, 2 .h 2 .m i assume the problem is here, but i dont know how to fix it, i already create my NSManaged Objects in AppDelegate just like examples – Arash Afsharpour Jul 23 '17 at 08:45
-1

Navigate to Build Phases in Xcode, then try to find if there were duplicated files in Compile Sources.

Hope that would hep you

Hady Nourallah
  • 442
  • 4
  • 12