微信WeChatSDK出现Undefined symbols for architecture x86_64错误

今天在写iOS项目时,需要用到微信登陆模块,所以引入了微信官方的iOS SDK,但是编译时一直出Mach-O的错误,怀疑是SDK本身的问题。于是建了个新的空项目,导入WeChatSDK,依旧报错,报错内容一致:

Undefined symbols for architecture x86_64:
“operator delete[](void*)”, referenced from:
+[WeChatApiUtil EncodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
+[WeChatApiUtil NsDataEncodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
+[WeChatApiUtil DecodeWithBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
+[WeChatApiUtil DecodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
“operator new[](unsigned long)”, referenced from:
+[WeChatApiUtil EncodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
+[WeChatApiUtil NsDataEncodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
+[WeChatApiUtil DecodeWithBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
+[WeChatApiUtil DecodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
“___gxx_personality_v0”, referenced from:
Dwarf Exception Unwind Info (__eh_frame) in AppDelegate.o
Dwarf Exception Unwind Info (__eh_frame) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

经研究,加入libc++.dylib可解决问题。

具体方法是:打开工程的属性窗口,在Build Phases的Link Binary With Libraries里面添加libc++.dylib

QQ20150409-1@2x



Comments are closed.