问题
I got linkage error like:
+[WeChatApiUtil DecodeBase64:] in libWeChatSDK.a(WeChatApiUtil.o)
"_deflate", referenced from:
+[MTAWXOHelper GZip:Out:] in libWeChatSDK.a(MTAWXOHelper.o)
"_deflateEnd", referenced from:
+[MTAWXOHelper GZip:Out:] in libWeChatSDK.a(MTAWXOHelper.o)
"_deflateInit2_", referenced from:
But I've already added those library to my target. But currently all those library have different extension .tbd.
Any idea? Thanks.
回答1:
There is a known issue in XCode 7 while linking tbd files. Here is the link to the apple developer forum answer on how to link tbd files in XCode 7 - https://forums.developer.apple.com/message/8609#8609
[Snippet from the link is available below]
This is a known issue in the Xcode 7 beta.
To work around this issue for now, please:
- Delete all references to .tbd files from either your linked libraries phase, or from the copied bundle resources phase (where they sometimes will be added).
- Add the library you want to link manually to the "Other Linker Flags" build settings, by adding the argument: -l for each library you want to link (for example, add "-lsqlite3" (without quotes)).
For those who are curious, the .tbd files are new "text-based stub libraries", that provide a much more compact version of the stub libraries for use in the SDK, and help to significantly reduce its download size.
回答2:
I have two project using zlib, one which finds it to link, one which doesn't. I set them both up by using the "+" in "Linked Frameworks and Libraries". I finally figured out how to fix the non-working one:
- Remove all links to zlib that you added in previous attempts
- Open Finder, head to
/usr/lib
, and drag thelibz.dylib
alias into your project's Frameworks folder - Compile. This worked on 2015/08/23 for me.
来源:https://stackoverflow.com/questions/30859416/how-to-link-to-libz-and-libsqlite-in-xcode-7-beta