如何将 zlib 添加到现有的 qt 安装

2021-12-09 00:00:00 zlib qt c++

如何将 zlib 添加到 Qt 的现有安装中.我在这方面很新,所以请给我详细的描述!提前感谢您的帮助!

How can I add zlib to an existing installation of Qt. I m pretty new in this so please give me detailed description! Thanks for your help in advance!

推荐答案

zlib 包含在核心 Qt 库中.如果你想在 Qt 程序中使用 zlib 函数,你只需要包含在 src/3rdparty/zlib 中的 zlib.h.见例如src/corelib/tools 中 QByteArray 的实现.

zlib is contained in the core Qt libraries. If you want to use the zlib functions in a Qt program, you only have to include zlib.h which is in src/3rdparty/zlib. See e.g. the implementation of QByteArray in src/corelib/tools.

如果您想使用 quazip,只需将库添加到您的项目中.它基于 Qt 库.注意构建与您的 Qt 安装相对应的正确 qyazip 库.

If you want to use quazip, just add the library to your project. It is based on the Qt libraries. Take care to build the correct qyazip library that corresponds to your Qt installation.

通过将以下行添加到项目文件中,您可以获得正确的包含路径:

You get the correct include path by adding the following line to your project file:

INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib

对于 Qt5,请参阅 Thorbj?rn 的评论:使用 #include 就足够了.

For Qt5, see Thorbj?rn's comment: it is sufficient to use #include <QtZlib/zlib.h>.

相关文章