本文介绍了zlib在Qt - QtZlib不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用QuaZip库,它有zlib依赖。我想在Archlinux和Windows 7下编译我的CMake管理的应用程序,在我安装Qt 5.3.0。



在Linux上: / p>

我已在这里阅读,zlib是Qt安装的本地部分。但在archlinux没有这样的目录。
因为我搜索所有其他Qt包括目录,包括QtCore,但没有zlib的迹象。另一方面,可以通过FindZLIB.cmake模块在archlinux上找到zlib的系统安装。



在Windows上:



在Qt的Windows安装中,在Qt包含目录中有QtZlib文件夹,因此可以包含它。然而,编译器总是抱怨他不能链接库中的zlib函数,错误日志。我还尝试通过TARGET_LINK_LIBRARIES手动设置外部zlib库,但没有成功。



有什么人能够在Qt5下使用CMake链接Zlib?

解决方案

Qt的zlib是一个内部实现细节。你不应该使用它。你需要链接你自己的zlib的副本,就像你根本不需要使用Qt。


I am using QuaZip library, which has zlib dependency. I want to compile my CMake managed application under Archlinux and Windows 7, in both I have Qt 5.3.0 installed.

On Linux:

I have read here "how to add zlib to an existing qt installation" that zlib is a native part of Qt installation. But in archlinux there is no such directory.Of cause I searched through all other Qt include directories including QtCore, but there was no sign of zlib. On the other hand system installation of zlib can be found on archlinux through FindZLIB.cmake module.

On Windows:

In the Windows installation of Qt there is QtZlib folder in Qt include directory, so it can be included. Nevertheless, compiler always complain that he cannot link zlib functions from library, error log here. I've also tried to set external zlib library manually through TARGET_LINK_LIBRARIES but with no success.

Have anybody experiance with linking Zlib under Qt5 using CMake ?

解决方案

Qt's zlib is an internal implementation detail. You're not supposed to use it. You need to link your own copy of zlib, just as you would need to if you weren't using Qt at all.

这篇关于zlib在Qt - QtZlib不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:25