How do I track down the cause of 'Undefined symbols for architecture x86_64'?

This is a little embarrassing, but I'm getting several self-inflicted errors after, I believe, fat-fingering my settings. I was working away and hit a strange combination of keys and the next thing I knew I was in my project settings. I didn't think much of it and so I went on working and the next time I tried to build my project, I started getting `Undefined symbols for architecture x86_64`, `ld: symbol(s) not found for architecture x86_64`, and `linker command failed with exit code 1 (use -v to see invocation)` errors:


Undefined symbols for architecture x86_64:
  "One_Rep_Max.LiftEvent.weightUnit.materializeForSet : One_Rep_Max.WeightUnit", referenced from:
      protocol witness for One_Rep_Max.LiftEventProtocol.weightUnit.materializeForSet : One_Rep_Max.WeightUnit in conformance One_Rep_Max.LiftEvent : One_Rep_Max.LiftEventProtocol in One_Rep_Max in LiftEvent.o
  "One_Rep_Max.LiftEvent.lift.materializeForSet : One_Rep_Max.Lift", referenced from:
      protocol witness for One_Rep_Max.LiftEventProtocol.lift.materializeForSet : One_Rep_Max.Lift in conformance One_Rep_Max.LiftEvent : One_Rep_Max.LiftEventProtocol in One_Rep_Max in LiftEvent.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Here's the change I made in my project that seems to be related because I added it to the file 'One_Rep_Max.LiftEvent':


protocol LiftEventProtocol {
    var liftName: String { get }
    var formulaName: String { get }
    var weightUnitName: String { get }
    var liftWeight: Double { get }
    var repetitions: NSNumber? { get }
    var maxWeight: Double { get }
    var lift: Lift { get set }
    var weightUnit: WeightUnit { get set }
    var liftEventDidChange: ((LiftEventProtocol) -> ())? { get set }
    var context: NSManagedObjectContext { get }
   
    func calculateOneRepMax()
}



In my search for answers I've found a lot of people who have similar problems are using third-party libraries but I'm not using any in my project. I've tried many of the suggested remedies like:


1. cleaned my project

2. deleted my Derived Data folder

3. Made sure all of my project files had their Target Membership set to my project

4. I **would** try to `use -v to see invocation` but I'm a noob and I don't know where I would do that

5. Checked many of my settings as suggested in a lot of the threads I've found


I don't want to try other things blindly because I'm afraid I'll make it worse. From the screenshot above, can anybody help me decipher what it says and give me a little guidance on what to try next?

Replies

>> 4. I **would** try to `use -v to see invocation` but I'm a noob and I don't know where I would do that


You don't need to. If you select the last (Report) option in the navigator pane, you can expand the build transcript, then (using the icon at the right) expand the linker step's transcript, which shows the full invocation. However, I'd bet this won't help you.


You are apparently using Core Data, and my guess is that you've got some kind of inconsistency between methods generated from the CD model and (either) methods you've implemented separately or methods you've required by your protocol.


As someone who'd rather bore a hole in their head with a sharpened stick than ever use Core Data again, I can't be more specific in my suggestions. However, I'd point out that if this project was under source code management, provided for free in Xcode, you'd be able to look and see what you changed.