Symbol(s) not found. Collect2: Id returned 1 exit

2019-07-14 20:22发布

问题:

I received the following error:

Undefined symbols:
  "_OBJC_CLASS_$_SurveyDelegate", referenced from:
      objc-class-ref-to-SurveyDelegate in Menus.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

The error was caused by removing SurveyDelegate and was fixed when I removed the code that tried to use a survery delegate. Why isn't it giving normal compile error? I already tried cleaning the project? In fact, it also let me declare a SurveyDelegate elsewhere and this error wasn't giving either a linker or compiler error.

Other questions

Objective c id returned 1 exit status - same name, but different problem

回答1:

Remove files of SurveyDelegate from project. Check the project directory in Finder for SurveyDelegate files. Remove them and recreate in XCode if necessary. Don't forget about cleaning (Cmd + Shift + K).