RAGOpoR
RAGOpoR

Reputation: 8168

ZipArchive library compile error

i have included libz.1.2.3.dylib

after insert code

ZipArchive* za = [[ZipArchive alloc] init];

error when compile

 "_OBJC_CLASS_$_ZipArchive", referenced from:

UPDATE

according to http://code.google.com/p/ziparchive/wiki/PageName

i have include ZipArchive folder to project, and and framework libz.1.2.3.dylib.

then i try to unzip file on iphone but it error about framework. how to resolve it?

Ld build/ePUBreader.build/Debug-iphoneos/ePUBreader.build/Objects-normal/armv7/ePUBreader normal armv7
cd /Users/ragopor/Desktop/ePUBreader
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk -L/Users/ragopor/Desktop/ePUBreader/build/Debug-iphoneos -F/Users/ragopor/Desktop/ePUBreader/build/Debug-iphoneos -filelist /Users/ragopor/Desktop/ePUBreader/build/ePUBreader.build/Debug-iphoneos/ePUBreader.build/Objects-normal/armv7/ePUBreader.LinkFileList -dead_strip -miphoneos-version-min=4.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework StoreKit -lz.1.2.3 -o /Users/ragopor/Desktop/ePUBreader/build/ePUBreader.build/Debug-iphoneos/ePUBreader.build/Objects-normal/armv7/ePUBreader

Undefined symbols:
  "_OBJC_CLASS_$_ZipArchive", referenced from:
      objc-class-ref-to-ZipArchive in ePUBreaderAppDelegate.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Upvotes: 6

Views: 6137

Answers (5)

Vineel Shah
Vineel Shah

Reputation: 1058

When you drag the ZipArchive folder into your project, you have to choose "Create groups for any added folders" and not "Create folder references for any added folders." If you choose the latter, you'll get the Undefined Symbol error from the linker.

Upvotes: 4

Karthikkumar
Karthikkumar

Reputation: 221

Then just drag & drop ZipArchive folder in to xCode "Classes".

Then add framework libz.1.2.3.dylib.

That's it. My code get compile without any issue.

Upvotes: 7

Ahmad Kayyali
Ahmad Kayyali

Reputation: 8243

i have used this library before, you need to compile the library in Xcode static library then later included it in your project, see the following link it will help you a lot.

http://code.google.com/p/ziparchive/issues/detail?id=4

Upvotes: 0

Codo
Codo

Reputation: 78835

You say you have added the ZipArchive folder to the project. From your description, it seems that the header file ZipArchive.h is found during the compilation of the project, but it does not compile the ZipArchive.mm file, which contains the ZipArchive class.

The file extension .mm seems strange to me. It might be the reason the file in't compiled. Try to rename it to ZipArchive.m and try again.

Upvotes: 0

jtbandes
jtbandes

Reputation: 118681

ZipArchive is not in libz.dylib. Where is ZipArchive supposed to come from? It's not getting compiled or linked to your app.

Upvotes: 0

Related Questions