主要是添加qt项目文件.pro内容:
这里要先下载quazip的c++项目先编译后引入到本项目中/zip目录下
INCLUDEPATH +=./zip
CONFIG(debug, debug|release) {
win32:win32-g++: PRE_TARGETDEPS += $$PWD/zip/libquazipd.a
win32:win32-g++: LIBS += -L$$PWD/zip/ -l quazipd
} else {
win32:win32-g++: PRE_TARGETDEPS += $$PWD/zip/libquazip.a
win32:win32-g++: LIBS += -L$$PWD/zip/ -l quazip
}
QT = core
INCLUDEPATH +=./zip
CONFIG(debug, debug|release) {
win32:win32-g++: PRE_TARGETDEPS += $$PWD/zip/libquazipd.a
win32:win32-g++: LIBS += -L$$PWD/zip/ -l quazipd
} else {
win32:win32-g++: PRE_TARGETDEPS += $$PWD/zip/libquazip.a
win32:win32-g++: LIBS += -L$$PWD/zip/ -l quazip
}
CONFIG += c++17 cmdline
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES +=
main.cpp
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES +=
zip/libquazipd.a
zip/quazipd.dll
HEADERS +=
zip/JlCompress.h
zip/quazip.h
zip/quazipfile.h
zip/quazipfileinfo.h
#include <QCoreApplication>
#include "JlCompress.h"
#include <iostream>
int printf(QString line)
{
std::cout<<line.toStdString()<<std::endl;
}
int printf(int line)
{
std::cout<<line<<std::endl;
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
//解压缩
JlCompress::extractDir("C:\data\obj\Tile_+006_+006_OBJ.zip","C:\data\obj\Tile_+006_+006_OBJ");
printf("解压缩成功");
JlCompress::compressDir("c:\data\obj\test55.zip","C:\data\obj\Tile_+006_+006_OBJ");
printf("压缩成功");
a.quit();
return a.exec();
}
本blog地址:https://blog.csdn.net/hsg77
原文地址:https://blog.csdn.net/hsg77/article/details/134725019
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_17863.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。