问题
Writing an app that will include the ability to decompress zip and rar files. I think I'm OK on how to handle the .zips but .rars seem a little more trouble. I noticed that rarlabs has source available but it's C++. Is there a way to compile, wrap or otherwise use this code within an iPhone app?
Reference: http://www.rarlab.com/rar_add.htm
Open to alternate suggestions on how to handle .rar files as well.
I'm still pretty much a newbie so please explain in small words :)
回答1:
If all you need is to decompress RAR files, this library may be much easier for you to compile since it's a single C source file:
http://www.unrarlib.org/features.html
I had looked at compiling the library you mentioned, but there were a lot of errors and it was not initially apparent just how to resolve some of them (file type was not the issue).
回答2:
Objective-C++ allows you to drop C++ code unaltered into an Obj-C source file (and give it a .mm extension). It really is that simple - I didn't believe my eyes the first time I did that, but it was super easy.
You can even mix C++/Obj-C types. See this project for a good example (it's a pretty small library, so it's pretty easy to navigate and see how they structured it): simple-iphone-image-processing. See the Image class in particular.
来源:https://stackoverflow.com/questions/2705181/compile-use-unrar-c-source-for-iphone-app