PhillipOReilly
PhillipOReilly

Reputation: 609

Apple Mach-O Linker Error Duplicate Symbols in Project Library

I modified my CoreData Data Set and added a couple of new classes to an error free iPhone App. Now when I try to compile I get this error:

Apple Mach-OP Linker Error Linker command failed with exit code 1 (use -v to see invocation)

duplicate symbol _OBJC_METACLASS_$_SchoolRecords in:
/Users/Yourself/Library/Developer/Xcode/DerivedData/.../YourProject.build/Debug-iphoneos/YourProject.build/Objects-normal/arm64/SchoolRecords.o

/Users/Yourself/Library/Developer/Xcode/DerivedData/.../YourProject.build/Debug-iphoneos/YourProject.build/Objects-normal/arm64/SchoolDivisions+Create.o
duplicate symbol _OBJC_CLASS_$_SchoolRecords in:

Objects-normal/arm64/SchoolDivisions+Create.o
duplicate symbol _OBJC_CLASS_$_SchoolRecords in:
/Users/Yourself/Library/Developer/Xcode/DerivedData/.../YourProject.build/Debug-iphoneos/YourProject.build/Objects-normal/arm64/SchoolRecords.o

I looked in the appropriate folder arm64 but see no duplicate files. So I have two questions:

1) Can I simply delete this folder hierarchy and start from scratch to see if that eliminates the problem?

2) How do I use the -v option to see invocation?

Thanks in advance for any hints.

Upvotes: 1

Views: 660

Answers (2)

PhillipOReilly
PhillipOReilly

Reputation: 609

Simple solution. While working on another project, I noticed Xcode's autocomplete was suddenly filling in .m rather than .h for #import statements. This had happened once on this project.

Changed import to .h and problem solved.

Lot of time spent on simple error.

Upvotes: 2

skrew
skrew

Reputation: 889

XCode use some .m files twice (or more) with the same functions.

  • Try project clean
  • Try restarting XCode

Do you have deleted older files ? Look in "Project" -> "Targets" -> "Library search path" if there are folder pointing to older path.

Also look in "Targets" -> "Build phases" -> "Compile sources" and check for any file who can have duplicate functions

Upvotes: 1

Related Questions