如何在Windows 10上使用Quazip和Qt 5.6,Qt Creator?

时间:2016-07-19 15:47:51

标签: c++ qt quazip

很抱歉,我没有这方面的经验,但我一直在网上搜索一下,想知道如何在Win 10上使用Quazip和Qt 5.6。我将非常感谢如何获得一系列步骤构建Quazip并在Qt Creator中使用它。

到目前为止,我尝试下载Quazip,并在我的.pro文件中包含pri文件

include(quazip-0.7.2/quazip.pri)

然后我替换了每个实例:

#include "zlib.h"

#include <zlib.h>

#include <QtZlib/zlib.h>

执行此操作后,我会收到许多编译器警告以及一些错误。

我的错误是:

QuaZIODevice::staticMetaObject': definition of dllimport static data member not allowed
QuaGzipFile::staticMetaObject': definition of dllimport static data member not allowed
QuaZipFile::staticMetaObject': definition of dllimport static data member not allowed

我的所有15个警告都包含:

inconsistent dll linkage

我非常感谢有关此事的任何帮助。

1 个答案:

答案 0 :(得分:2)

文件引用:

  

默认情况下,QuaZIP编译为DLL / SO,但您还有其他选项:

     
      
  • 只需将适当的源文件复制到项目中并使用它们,但您需要在包含任何QuaZIP标头之前定义QUAZIP_STATIC(最好作为编译器选项完成)。这将使您免于导入/导出QuaZIP符号的可能副作用。
  •   

这似乎就是您正在做的事情,因此您应该将DEFINES += QUAZIP_STATIC添加到.pro文件中。