Failed build b/c symbols not found zlib

早过忘川 提交于 2019-12-10 14:13:53

问题


I have a problem adding libs for zip extraction to my iPhone app.

I decided to use SSZipArchive. It uses minizip.

After following the instructions:

1 Add SSZipArchive.h, SSZipArchive.m, and minizip

2 Add the libz library to your target

I still get errors:

Symbol(s) not found.

I tried adding -lz to Other Linker Flags and adding lybz.dylib but it didn't help. Please let me know if you know how to get libz to work here.


Solved: Instead of using a folder, I made a yellow reference group, removed /minizip/ from includes and now everything works.


回答1:


unzOpen, unzOpenCurrentFile, and unzOpenCurrentFilePassword are functions defined in the minizip library. The linker is complaining that it can't find those functions, which means they're not getting compiled or linked in properly.

Make sure that minizip/unzip.c is included in your project properly and double-check that it's getting compiled and linked.




回答2:


The key to this is to make sure

All the .c files under /minizip/ are added to "Build Phases > Compiled Sources"


For Cordova developers who want to use SSZipArchive , make sure you don't include the whole /minizip/ folder as source file in plugin.xml ,

    <source-file src="src/ios/minizip"/>

^^^^^^^^No!

Include them separately as and :

<header-file src="src/ios/minizip/crypt.h" target="crypt.h" />
<source-file src="src/ios/minizip/ioapi.c" target="ioapi.c" />
<header-file src="src/ios/minizip/ioapi.h" target="ioapi.h" />
<source-file src="src/ios/minizip/mztools.c" target="mztools.c" />
<header-file src="src/ios/minizip/mztools.h" target="mztools.h" />
<source-file src="src/ios/minizip/unzip.c" target="unzip.c" />
<header-file src="src/ios/minizip/unzip.h" target="unzip.h" />
<source-file src="src/ios/minizip/zip.c" target="zip.c" />
<header-file src="src/ios/minizip/zip.h" target="zip.h" />


来源:https://stackoverflow.com/questions/3956138/failed-build-b-c-symbols-not-found-zlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!