独立跨平台 (Windows/Linux)) C/C++ 文件压缩?
我正在寻找一个(最好是小的)C 或 C++ 开源库,我可以将其包含在我的 MIT 许可项目中(托管在 google 代码上)。我是一名业余爱好 C/C++ 程序员,所以我并不那么先进,但我只知道为名为“SA-MP”的应用程序(适用于 Windows 和 Linux)开发插件所需的东西。 我愿意制作一个自动安装程序,它需要能够解压缩压缩文件(最好是 .zip,但任何其他文件压缩方法都可以!)。
我一直在寻找这样的库,但他们总是需要在 Windows 上有一些额外的 dll 或在 Linux 上有一些其他文件 - 这不是我正在寻找的东西,因为最终用户可能无法知道如何安装插件及其所需的组件。
还查看了基本压缩库,它似乎没有文件压缩,而只是算法。所以对于这个我就不走运了。
简而言之:
- 没有外部依赖项,如果需要的额外库可以链接到我的 C/C++ 项目,则允许它们。
- 可以压缩整个目录并解压它们。
- 适用于 Windows 和 Linux。
- 可以通过 MIT 许可证安全使用(可选,首选)
I am looking for a (prefferably small) open source library in C or C++ which I can include in my MIT licensed projects (hosted on google code). I am a hobby C/C++ programmist so I am not that advanced, however I know just the things I need to develop plugins for a application named "SA-MP" (works on Windows and Linux).
What I am willing to make is an auto installer which will need to be able to uncompress compressed files (prefferably .zip, but any other file compression method will do!).
I have looked for such a library but they always need to have some extra dll's on windows or some other files on linux - which is not the thing I am looking for as the end-users may not be able to know how to install the plugin with it's required components.
Looked also at Basic Compression Library and it seems it doesn't have file compression, but just algorithms. So with that one I'm out of luck.
To make the above text short:
- No external depencies, extra libraries which are needed are allowed if they can be linked to my C/C++ project.
- Can compress whole directories and unpack them.
- Works on windows and linux.
- Can be safely used with MIT license (optional, preffered)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
zlib (这是显而易见的第一件事;每个人都使用它)或 libzip (第一次点击 freshmeat )?
一般来说,没有任何技术原因导致您需要动态链接任何东西。你不知道。然而,LGPL 许可的库有一个合法的原因,因为 LGPL 在动态对象边界停止,所以静态链接也使其他代码成为 LGPL。
What's wrong with zlib (that's the obvious first thing to look at; everybody uses that) or libzip (first hit on freshmeat)?
In general, there is no technical reason why you'd need to link anything dynamically. You don't. There is, however, a legal reason for LGPL-licensed libraries, because LGPL stops at dynamic object boundary, so static linking makes the other code LGPL as well.
关于压缩库,有几种依赖性从低到极低的替代方案。我首先想到的确实是 Zlib,但可以公平地说,仅它的源代码树就相当“拥挤”。话虽这么说,我想这并不取决于其他什么特别的事情。
更简单,但也更轻便,您会找到诸如 LZ4 之类的替代方案,其中整个源代码填充到单个文件中,外部依赖项仅限于 stdlib 等。
您可能会在找到扫描目录的可移植库时遇到更多困难,因为这些东西往往依赖于操作系统。我在想 Shelwien 的 Shar,但它可能与 Windows 相关。
Regarding compression libraries, there are several alternatives with low to very low dependancies. Zlib is really the first which comes to mind, but it's fair to say that its source tree alone is quite "crowded". That being said, i guess it does not depend on anything else special.
Much simpler, but also much lighter, you'll find alternatives such as LZ4, where the whole source code fills into a single file, and external dependancies are limited to stdlib and such.
You will probably have more difficulties in finding a portable library which scans directories, since such things tend to be OS dependant. I was thinking about Shelwien's Shar, but it may be tied to Windows.