3

I'm getting these Apple Mach-O Linker errors and I don't know how to read these things. I got these error after importing "CLCredentialHeader.h" and "CLCredentialHeader.m" in my project.

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_SFHFKeychainUtils", referenced from:
      objc-class-ref in CLCredentialHandler.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
jscs
  • 63,694
  • 13
  • 151
  • 195
chrisjr
  • 760
  • 3
  • 11
  • 18
  • 1
    Did you try searching for any of the _many_ questions with this linker error? – jscs Apr 27 '12 at 20:27
  • 1
    possible duplicate of [iPhone Linker Error (AudioStreamer)](http://stackoverflow.com/questions/3471262/iphone-linker-error-audiostreamer) – jscs Apr 27 '12 at 20:27
  • 1
    I looked in Google and I didn't find one that's identical. Further, I don't know how to read these kinds of errors (though trying my best) so I can't properly decipher the answers from those other questions. – chrisjr Apr 27 '12 at 20:30

3 Answers3

19

Make sure that SFHFKeychainUtils.m appears in the "Compile Sources" Build Phase for your build target. Sometimes, adding files to a project in Xcode doesn't add all implementation files to the appropriate targets.

warrenm
  • 31,094
  • 6
  • 92
  • 116
10

I get this sometimes when I drag and drop a class from another project and forget to mark "add to targets" in the window that pops up. I think this is a very legitimate question. The error messages are also not very intuitive. The solution is easy in XCode clicking on the project, and click on "Build Phases" and open the "Compile Source" then say "+". Here some pictures that say more then all the words.

So if the error looks like this, it tells me DataAccess class is undefined.

enter image description here

I recognize this as a class I just dragged and dropped into the project. I add DataAccess.m to my project

enter image description here

Originally I could have avoided it by marking "Add to targets"

enter image description here

hol
  • 8,255
  • 5
  • 33
  • 59
1

If above answers does not work for you then check you have added Security framework. If not then add it in Build Phase section of Targets. Should be fine then :)

Mann
  • 5,477
  • 6
  • 45
  • 57