Qt中调用zlib的出现undefined referrence to uncompress

zzllvlv 2019-08-31 06:35:14
我将zlib库编译好后,包括zlib.h和zconf.h文件,dll文件,lib文件。将.h文件拷贝到源码文件中,在自己的cpp文件中添加 #include zlib.h,在pro文件中添加外部库时,选择了lib文件,但是运行时依然提示undefined referrence to uncompress,请问怎么处理?往上的方法我都看了,还是不行。
...全文
443 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjwx0017 2019-09-04
  • 打赏
  • 举报
回复
主要是那两个编译器编译的导入库格式不一样,不兼容
zzllvlv 2019-09-04
  • 打赏
  • 举报
回复
引用 2 楼 yjwx0017 的回复:
编译zlib 和Qt使用的编译器是否是一样的? 我之前貌似遇到过这个提示当时是库是vs编译的,Qt是mingw gcc的

确实不是同个编译器。但是我使用的是VS编译出动态库来用,Qt说是可以正常调用一般dll库的
yjwx0017 2019-09-03
  • 打赏
  • 举报
回复
编译zlib 和Qt使用的编译器是否是一样的? 我之前貌似遇到过这个提示当时是库是vs编译的,Qt是mingw gcc的
astro_lee 2019-08-31
  • 打赏
  • 举报
回复
QByteArray::qUncompress就是用的zlib: Uncompresses the data byte array and returns a new byte array with the uncompressed data. Returns an empty QByteArray if the input data was corrupt. This function will uncompress data compressed with qCompress() from this and any earlier Qt version, back to Qt 3.1 when this feature was added. Note: If you want to use this function to uncompress external data that was compressed using zlib, you first need to prepend a four byte header to the byte array containing the data. The header must contain the expected length (in bytes) of the uncompressed data, expressed as an unsigned, big-endian, 32-bit integer.

16,212

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧