Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 918
jacksun Avatar asked Apr 29 '26 23:04

jacksun


1 Answers

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.

like image 102
Reid Main Avatar answered May 01 '26 20:05

Reid Main



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!