Compiling ZipArchive in XCode 4 project - iphone

I'm trying to compile ZipArchive with my project. I imported all the source files, including the minizip files and I am at a loss to understand these errors. I've tried a dozen other ways to incorporate compression/decompression into my iphone project, all with out success. ZipArchive seems to be the best library out, and this problem looks like it's a simple build settings configuration problem but I cannot figure it out.
Undefined symbols for architecture armv6:
"_zipClose", referenced from:
-[ZipArchive CloseZipFile2] in ZipArchive.o
"_zipOpenNewFileInZip3", referenced from:
-[ZipArchive addFileToZip:newname:] in ZipArchive.o
"_unzOpenCurrentFile", referenced from:
-[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
"_unzGetGlobalInfo", referenced from:
-[ZipArchive UnzipOpenFile:] in ZipArchive.o
"_unzReadCurrentFile", referenced from:
-[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
"_unzOpen", referenced from:
-[ZipArchive UnzipOpenFile:] in ZipArchive.o
"_unzCloseCurrentFile", referenced from:
-[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
"_zipWriteInFileInZip", referenced from:
-[ZipArchive addFileToZip:newname:] in ZipArchive.o
"_zipOpenNewFileInZip", referenced from:
-[ZipArchive addFileToZip:newname:] in ZipArchive.o
"_unzGoToFirstFile", referenced from:
-[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
"_unzGetCurrentFileInfo", referenced from:
-[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
"_zipCloseFileInZip", referenced from:
-[ZipArchive addFileToZip:newname:] in ZipArchive.o
"_unzClose", referenced from:
-[ZipArchive UnzipCloseFile] in ZipArchive.o
"_zipOpen", referenced from:
-[ZipArchive CreateZipFile2:] in ZipArchive.o
"_unzGoToNextFile", referenced from:
-[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
"_unzOpenCurrentFilePassword", referenced from:
-[ZipArchive UnzipFileTo:overWrite:] in ZipArchive.o
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status

I had exactly the same issue. I use Xcode 4.4 for iOS 5.1.
And I solved it this way:
Remove the all ZipArchive-Files incl. Minizip-Folder from your project - move to trash.
Re-Add both ZipArchive-Files and the Minitip-Folder and ENSURE YOU SELECT THE OPTION "Create groups for any added folder" instead of "Create folder references for any added folder".
if you use ARC, then add to all Build Phases -> Compile Sources ZipArchive-Items the option "-fno-objc-arc"
That´s it - good luck.

When I tried it will easily compiled with following link
http://code.google.com/p/ziparchive/wiki/PageName
I just take folder in following Form
ZipArchive
ZipArchive.h
ZipArchive.mm
minizip (Folder)
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.

I got it working by adding "/usr/lib/libz.dylib" to the Other Link Flags in the targets section of Project settings.
It worked for me with Minizip.

I also fell into this same case....
But I found the following resolution.
http://travitu.hatenablog.jp/entry/2014/12/23/005037
I solved it this way:
・When you add ZipArchive-Files and the Minitip-Folder to your project,
you should check "Copy items if needed" and "Create groups".
That's all.

I got this working by adding libz.tdb file. (Xcode 7, iOS 9). Error gone.

Related

Undefined symbols for architecture armv7 after adding .a file

I'm trying to build a small app using a *.a, *.h file I received from a certain vendor.
this is the first time I'm adding external files to a project.
I added the files and I am getting these errors.
Undefined symbols for architecture armv7:
"_vDSP_fft_zropD", referenced from:
_fft_hr_estimation in libmyTrekSDK_armv7.a(hr_calc.o)
"_vDSP_vclrD", referenced from:
_fft_hr_estimation in libmyTrekSDK_armv7.a(hr_calc.o) "_vDSP_vdbconD", referenced from:
_fft_hr_estimation in libmyTrekSDK_armv7.a(hr_calc.o)
"_vDSP_vmulD", referenced from:
_fft_hr_estimation in libmyTrekSDK_armv7.a(hr_calc.o) "_vDSP_hamm_windowD", referenced from:
_fft_hr_init in libmyTrekSDK_armv7.a(hr_calc.o) "_vDSP_zaspecD", referenced from:
_fft_hr_estimation in libmyTrekSDK_armv7.a(hr_calc.o) "_OBJC_CLASS_$_EAAccessoryManager", referenced from:
objc-class-ref in libmyTrekSDK_armv7.a(hrMonitor.o) "_EAAccessoryDidDisconnectNotification", referenced from:
-[HRMonitor startup] in libmyTrekSDK_armv7.a(hrMonitor.o) "_vDSP_create_fftsetupD", referenced from:
_fft_hr_init in libmyTrekSDK_armv7.a(hr_calc.o) "_EAAccessoryDidConnectNotification", referenced from:
-[HRMonitor startup] in libmyTrekSDK_armv7.a(hrMonitor.o) "_OBJC_CLASS_$_EASession", referenced from:
objc-class-ref in libmyTrekSDK_armv7.a(hrMonitor.o) "_vDSP_ctozD", referenced from:
_fft_hr_estimation in libmyTrekSDK_armv7.a(hr_calc.o) "_vDSP_maxmgvD", referenced from:
_fft_hr_estimation in libmyTrekSDK_armv7.a(hr_calc.o) "_vDSP_destroy_fftsetupD", referenced from:
_fft_hr_free in libmyTrekSDK_armv7.a(hr_calc.o) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed
with exit code 1 (use -v to see invocation)
So far I've tried: (mentioned in other posts)
I've made sure the the *.a file is included in the Link Binary With Library .
Tried to change C++ Language Dialect and C++ Standard Library to Compiler Default.
More info:
The files are in the project folder.
I'm using an iPhone 4S v.6.1.3 and the project's deployment target is iOS 6.1.
Just for future I got the "_OBJC_CLASS_$_EASession", referenced from: error. It was fixed by adding ExternalAccessory.framework to Targets > myApp > Build Phases > Link Binary with Libraries
Check lib path is correct in framework search path / library search path
check other linker flags needed for your lib source
Please refer this Answer for more details

Linker errors after upgrade to xcode 3.2.3 for iphone app

I've just upgraded to XCODE 3.2.3 and upgraded my base sdk from 3.0 to 3.2 iphone sdk. After doing this I started getting a bunch of link errors with barely any info, here's what I got:
".objc_class_name_CATransition", referenced from:
".objc_class_name_NSObject", referenced from:
".objc_class_name_NSFileManager", referenced from:
".objc_class_name_NSString", referenced from:
".objc_class_name_NSError", referenced from:
".objc_class_name_CABasicAnimation", referenced from:
".objc_class_name_NSOperation", referenced from:
".objc_class_name_CJSONDeserializer", referenced from:
".objc_class_name_UIWindow", referenced from:
".objc_class_name_NSException", referenced from:
".objc_class_name_UIColor", referenced from:
".objc_class_name_CATransaction", referenced from:
".objc_class_name_CLLocationManager", referenced from:
".objc_class_name_MPMoviePlayerController", referenced from:
".objc_class_name_NSMutableSet", referenced from:
".objc_class_name_UIFont", referenced from:
".objc_class_name_NSFileHandle", referenced from:
".objc_class_name_MFMailComposeViewController", referenced from:
".objc_class_name_CAKeyframeAnimation", referenced from:
".objc_class_name_UIImage", referenced from:
".objc_class_name_UIApplication", referenced from:
".objc_class_name_UILabel", referenced from:
".objc_class_name_UIView", referenced from:
".objc_class_name_CLLocation", referenced from:
".objc_class_name_NSMutableString", referenced from:
".objc_class_name_CJSONSerializer", referenced from:
".objc_class_name_NSTimer", referenced from:
".objc_class_name_NSValue", referenced from:
".objc_class_name_NSMutableData", referenced from:
".objc_class_name_NSNumber", referenced from:
"_objc_exception_match", referenced from:
".objc_class_name_UINavigationItem", referenced from:
".objc_class_name_UIViewController", referenced from:
".objc_class_name_NSMutableArray", referenced from:
".objc_class_name_UIScreen", referenced from:
".objc_class_name_NSHTTPCookieStorage", referenced from:
".objc_class_name_MKPinAnnotationView", referenced from:
".objc_class_name_NSNotificationCenter", referenced from:
"_OBJC_CLASS_$_QWAdView", referenced from:
".objc_class_name_NSProcessInfo", referenced from:
".objc_class_name_UITableViewCell", referenced from:
".objc_class_name_CAAnimationGroup", referenced from:
".objc_class_name_NSInvocation", referenced from:
".objc_class_name_NSURL", referenced from:
".objc_class_name_NSSet", referenced from:
"_objc_exception_extract", referenced from:
".objc_class_name_UISearchBar", referenced from:
".objc_class_name_NSMutableURLRequest", referenced from:
".objc_class_name_NSRunLoop", referenced from:
".objc_class_name_NSData", referenced from:
".objc_class_name_NSDate", referenced from:
".objc_class_name_UIBarButtonItem", referenced from:
".objc_class_name_UITableView", referenced from:
".objc_class_name_NSURLRequest", referenced from:
".objc_class_name_NSOperationQueue", referenced from:
".objc_class_name_UIActionSheet", referenced from:
".objc_class_name_UIDevice", referenced from:
".objc_class_name_MKMapView", referenced from:
".objc_class_name_UIToolbar", referenced from:
".objc_class_name_NSXMLParser", referenced from:
".objc_class_name_NSHTTPCookie", referenced from:
".objc_class_name_UIImageView", referenced from:
".objc_class_name_CAMediaTimingFunction", referenced from:
".objc_class_name_NSScanner", referenced from:
"_objc_exception_try_exit", referenced from:
".objc_class_name_NSDateFormatter", referenced from:
".objc_class_name_UIAccelerometer", referenced from:
"_objc_exception_try_enter", referenced from:
".objc_class_name_NSCharacterSet", referenced from:
".objc_class_name_UIScrollView", referenced from:
".objc_class_name_UIButton", referenced from:
".objc_class_name_UINavigationBar", referenced from:
".objc_class_name_UIAlertView", referenced from:
".objc_class_name_NSUserDefaults", referenced from:
".objc_class_name_NSThread", referenced from:
".objc_class_name_NSPropertyListSerialization", referenced from:
"_OBJC_CLASS_$_GANTracker", referenced from:
".objc_class_name_NSMutableDictionary", referenced from:
".objc_class_name_CALayer", referenced from:
".objc_class_name_UIWebView", referenced from:
".objc_class_name_NSBundle", referenced from:
".objc_class_name_NSURLConnection", referenced from:
".objc_class_name_NSAutoreleasePool", referenced from:
".objc_class_name_UIPageControl", referenced from:
".objc_class_name_NSAssertionHandler", referenced from:
".objc_class_name_MKAnnotationView", referenced from:
".objc_class_name_NSDictionary", referenced from:
".objc_class_name_NSLocale", referenced from:
".objc_class_name_NSArray", referenced from:
".objc_class_name_UIActivityIndicatorView", referenced from:
"_OBJC_CLASS_$_AdMobView", referenced from:
Any ideas?
UPDATE:
Seems like 3rd party libraries are causing the issues. These include libraries for admob, quattro, and Google Analytics. Only admob has updated their libraries so will have to remove the other ones
Same problem. Tons of link errors when compiling for simulator; device works fine.
Checked frameworks as suggested by Sim but looked fine.
Edit: All of the problems seem to be with pre-compiled 3rd party libraries (in my case that means the Facebook Three20.a library and Occipital's libRedLaserSDK.a). Anybody know if I need to use versions of those libraries recompiled for 4.0, or if there is there another fix?
Edit2: And one more clue, which suggests some of the other posters are on the right track: in my project "Groups & Files" list, all of my frameworks appear in red text. Yet if I check any one of them, the target checkbox is checked.
I don't know why this suddenly started happening when you upgraded, but these link errors mean that your link line is missing some frameworks. It would be very helpful to see the full compiler output (expand the transcript in Build Results to get this).
Looks like QuartzCore, Foundation, MediaPlayer, UIKit and others are missing, based on the symbols which are undefined. I figured this out by searching for the missing symbols (e.g. "NSOperation") in the iPhone developer site. The documentation for each function lists the framework that defines the function.
Check Frameforks is checked for the new build target. Select UIkit.framework -> Get Info and check general and targets tabs
I would try reinstalling XCode.
Backup your /Developer folder first then give these steps a go.
From the terminal use:
sudo /Developer/Library/uninstall-devtools --mode=all
to uninstall XCode and the iPhone SDKs, then delete the /Developer folder after you've done this to ensure that XCode and the iPhone SDK have been cleanly removed from your system. Reinstall Xcode afterwards.
I had this same problem a couple of days ago, but for me just restarting Xcode fixed it, I could build my app without any problems. I have no idea what caused this to happen in the first place, though.

iPhone OpenCv build issues

I'm trying to build open_cv on the iphone. I'm a pre-compiled version of it from http://github.com/niw/iphone_opencv_test and am seeing the following build errors...
"_cvCvtColor", referenced from:
+[PFFaceDetection CreateIplImageFromUIImage:] in PFFaceDetection.o
"_OBJC_CLASS_$_PFImageEffects", referenced from:
objc-class-ref-to-PFImageEffects in PFEditorViewController.o
"_cvReleaseHaarClassifierCascade", referenced from:
+[PFFaceDetection detectFacesWithImage:] in PFFaceDetection.o
"_cvHaarDetectObjects", referenced from:
+[PFFaceDetection detectFacesWithImage:] in PFFaceDetection.o
"_cvReleaseMemStorage", referenced from:
+[PFFaceDetection detectFacesWithImage:] in PFFaceDetection.o
"_cvCreateImage", referenced from:
+[PFFaceDetection CreateIplImageFromUIImage:] in PFFaceDetection.o
+[PFFaceDetection CreateIplImageFromUIImage:] in PFFaceDetection.o
-[UIImage(OpenCV) cvGrayscaleImage] in UIImageOpenCV.o
-[UIImage(OpenCV) cvImage] in UIImageOpenCV.o
"_cvEqualizeHist", referenced from:
+[PFFaceDetection detectFacesWithImage:] in PFFaceDetection.o
"_cvLoad", referenced from:
+[PFFaceDetection detectFacesWithImage:] in PFFaceDetection.o
"_cvCreateMemStorage", referenced from:
Probably this article will help you: http://computer-vision-talks.com/2011/01/using-opencv-in-objective-c-code/
It looks like you didn't link proper OpenCV libraries into your project. Example project uses different library paths depending on the current selected architecture. Instead, it is possible to rename simulator versions and drag all four files into Xcode project.

iPhone CAAnimation problem

I am getting the following errors when I try to use the CAAnimation constants, in a program I just wrote. I am able to run the "ViewTransitions" example (from the apple library, http://developer.apple.com/iphone/library/samplecode/ViewTransitions/index.html), and I do not see anything that has been done there, that I haven't :mad:.
P.S. - I did include QuartzCore/QuartzCore.h ..
"_kCAMediaTimingFunctionEaseInEaseOut", referenced from:
_kCAMediaTimingFunctionEaseInEaseOut$non_lazy_ptr in EMISNewsWebViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
"_kCATransitionFromTop", referenced from:
_kCATransitionFromTop$non_lazy_ptr in EMISNewsWebViewController.o
"_kCATransitionPush", referenced from:
_kCATransitionPush$non_lazy_ptr in EMISNewsWebViewController.o
".objc_class_name_CAMediaTimingFunction", referenced from:
literal-pointer#__OBJC#__cls_refs#CAMediaTimingFunction in EMISNewsWebViewController.o
".objc_class_name_CATransition", referenced from:
literal-pointer#__OBJC#__cls_refs#CATransition in EMISNewsWebViewController.o
"_kCAMediaTimingFunctionEaseInEaseOut", referenced from:
_kCAMediaTimingFunctionEaseInEaseOut$non_lazy_ptr in EMISNewsWebViewController.o
Any help will be greatly appreciated.
Check if you have added QuartzCore.framework to link to your project.

How do I use Apple Keychain?

I am using trying to use scifihifi-iphone (from Github) to store and retrieve usernames and passwords. However, when I add the class SFHFKeychainUtils I get the following errors:
"_kSecAttrAccount", referenced from:
_kSecAttrAccount$non_lazy_ptr in SFHFKeychainUtils.o
"_SecItemDelete", referenced from:
+[SFHFKeychainUtils deleteItemForUsername:andServiceName:error:] in SFHFKeychainUtils.o
"_kSecReturnAttributes", referenced from:
_kSecReturnAttributes$non_lazy_ptr in SFHFKeychainUtils.o
"_kSecClass", referenced from:
_kSecClass$non_lazy_ptr in SFHFKeychainUtils.o
"_kSecClassGenericPassword", referenced from:
_kSecClassGenericPassword$non_lazy_ptr in SFHFKeychainUtils.o
"_SecItemAdd", referenced from:
+[SFHFKeychainUtils storeUsername:andPassword:forServiceName:updateExisting:error:] in SFHFKeychainUtils.o
"_kSecAttrLabel", referenced from:
_kSecAttrLabel$non_lazy_ptr in SFHFKeychainUtils.o
"_SecItemUpdate", referenced from:
+[SFHFKeychainUtils storeUsername:andPassword:forServiceName:updateExisting:error:] in SFHFKeychainUtils.o
"_kSecAttrService", referenced from:
_kSecAttrService$non_lazy_ptr in SFHFKeychainUtils.o
"_kSecReturnData", referenced from:
_kSecReturnData$non_lazy_ptr in SFHFKeychainUtils.o
"_SecItemCopyMatching", referenced from:
+[SFHFKeychainUtils getPasswordForUsername:andServiceName:error:] in SFHFKeychainUtils.o
+[SFHFKeychainUtils getPasswordForUsername:andServiceName:error:] in SFHFKeychainUtils.o
"_kSecValueData", referenced from:
_kSecValueData$non_lazy_ptr in SFHFKeychainUtils.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
What am I leaving out? When I click the errors, it doesn't take me to any place in the code.
Add Security.framework, then rebuild. Sometimes I find I have to build clean and then rebuild.
To add this, right click on your target in Xcode, then Add->Existing Frameworks and choose (or navigate) to Security.framework.