jacksun
jacksun

Reputation: 91

xcode static library link error while building for iPhone device

I am using xcode 4.6. The SDK is iOS 6.1. The error I got is "Undefined symbols for architecture armv7" while project linking my own created static library, called "libEncrypt.a".

I am sure I have created the libEncrpt.a using architecture armv7. Using "otool -a" to verify the static library, it displays below message. Don't understand why xcode sill complains the error like "Undefined symbols for architecture armv7"??

> otool  -a libEncrypt.a 
Archive : libEncrypt.a (architecture armv7)
0100644 505/20    108 1360127518 #1/20
0100644 505/20   3604 1360127513 #1/20
Archive : libEncrypt.a (architecture armv7s)
0100644 505/20    108 1360127518 #1/20
0100644 505/20   3604 1360127513 #1/20

Add the detail error message blow:

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_libEncrypt", referenced from:
      objc-class-ref in LoginViewController.o
      objc-class-ref in SignupViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upvotes: 3

Views: 1724

Answers (1)

Reid Main
Reid Main

Reputation: 3404

Double check your "Build Active Architecture Only" settings in your app and static library projects.

I had this exact same issue because I had "Build Active Architecture Only" set to YES for my static library but not for my iOS app. When the iOS app tried do a Debug build it expected all architectures to exist but only armv7s was being built for the static library because I was deploying to my iPhone 5.

Upvotes: 2

Related Questions