我正在使用xcode 4.6 . SDK是iOS 6.1 . 我得到的错误是 "Undefined symbols for architecture armv7" ,同时项目链接我自己创建的静态库,名为"libEncrypt.a" .
我确信我已经使用架构armv7创建了libEncrpt.a . 使用"otool -a"验证静态库,它显示在下面的消息 . 不明白为什么xcode sill抱怨像 "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
添加详细错误消息:
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)
1 回答
仔细检查应用程序和静态库项目中的“仅构建活动体系结构”设置 .
我有这个完全相同的问题,因为我为我的静态库设置了“仅构建活动架构”,但不是我的iOS应用程序 . 当iOS应用程序尝试进行Debug构建时,它希望所有架构都存在,但只为armv7构建了静态库,因为我正在部署到我的iPhone 5 .