Qt 和 zip 文件

发布于 2024-10-19 11:10:19 字数 198 浏览 2 评论 0原文

我正在尝试编写一个简单的 Qt 应用程序,它将访问 zip 文件并读取这些 zip 文件的内容(内容是文本文件)。许多帖子都说 Quazip 是解决方案。

作为Qt新手并且来自.Net背景,我真的不知道如何使用Quazip,我下载了Quazip源代码,但我不确定,我应该编译它还是应该在我的项目中使用源代码。我真的不知道。

非常感谢任何帮助。 问候。

I'm trying to write a simple Qt app that will access zip files and read the content of these zip files (the content are text files). Many posts says that Quazip is the solution.

Being new to Qt and coming from .Net background, I really don't know how to use the Quazip, I downloaded the Quazip source but I'm not sure, should I compile it or should I use the source code in my project. I really have no clue.

Any help is much appreciated.
Regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美人骨 2024-10-26 11:10:19

看来你有多种选择。您可以通过将相关文件复制到您的项目中来立即使用源代码。然而,默认情况下,运行时会编译静态库

> make install

,在这种情况下,您需要将相关路径添加到 .pro 文件,以便它找到静态库。

It seems as you have various options. You can use source code immediately by copying the relevant files into your project. By default however a static library is compiled when you run

> make install

and in that case you need to add the relevant path to your .pro file so that it finds is static library.

鹿! 2024-10-26 11:10:19

那么,您有多种选择:

  • 只需将源添加到您的项目中即可。优点:您可以根据需要修改它们,而不会影响您的其他项目。缺点:更新 QuaZip 可能会是一个令人头痛的维护问题。
  • 将其编译为静态库(qmake CONFIG+=staticlib)。优点:更新更容易,因为您不必处理结构更改,只需重新编译 QuaZip 并重建/重新链接您的项目。缺点:您仍然需要重新编译和重新链接。
  • 将 QuaZip 编译为共享 (DLL) 库。优点:只要新版本保持二进制兼容性,并且代码在同时运行的各种应用程序之间共享,更新就非常容易。缺点:如果新版本不保持二进制兼容性,它将破坏一切(也就是说,直到您重建/重新链接您的应用程序)。

如果您只需要读取某个随机项目中的一些 zip 文件,那么这三个中的任何一个都可以。您可能也不必更新 QuaZip,除非您发现一些需要修复的错误。

至于二进制兼容性:保证第三级版本更改(xyz1 -> xyz2)是二进制兼容的。至于次要版本更改(x.y1 -> x.y2),它们可能在一段时间内不会兼容二进制,直到 Pimpl 惯用法正确实现为止。

Well, you have several options:

  • Just add the sources to your project. Pros: you can modify them if you want without affecting your other projects. Cons: updating QuaZip is probably going to be a maintenance headache.
  • Compile it as a static library (qmake CONFIG+=staticlib). Pros: updating is easier as you don't have to deal with structural changes, only recompile QuaZip and rebuild/relink your projects. Cons: you still have to recompile and relink.
  • Compile QuaZip as a shared (DLL) library. Pros: updating is extremely easy provided that the new version maintains binary compatibility, plus the code is shared among various applications running at the same time. Cons: it will break everything (that is, until you rebuild/relink your apps) if the new version doesn't maintain binary compatibility.

If you just need to read some zip files in some random project, any of these three will do fine. You probably won't have to update QuaZip either, unless you find some bugs that need to be fixed.

As for the binary compatibility: it is guaranteed that third level version changes (x.y.z1 -> x.y.z2) are binary compatible. As for minor version changes (x.y1 -> x.y2), they probably won't be binary compatible for some time, until the Pimpl idiom is implemented properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文