qt5.4.0 extracting zip files using Quazip

Source: Internet
Author: User
Tags win32 zip zip folder

Very simple question, because do not understand, Leng got a good long time, dedicated to the novice, PS: First hair bo

I only tested the implementation on the Qtcreate, no attempt in VS, the process should be the same, please play your own


Follow me on a step-by-step:

1.souceforge Download Address: http://sourceforge.net/projects/quazip/Download the latest quazip, this time I downloaded the quazip-0.7.2


Direct compilation will be error, to make the following changes:

2. Open the Quazip.pro you just downloaded and put the

Subdirs=quazip Qztest instead
Subdirs=quazip


3. Copy the two header files from the QT installation directory (Zlib.h and zconf.h), the different version paths may differ, can search into the following image



4. Copy the two header files to the Quazip project path, path: \quazip-0.7.2\quazip\, and then add to the project program, compile--success.

After doing the above simple operation, the program will not error, will generate Libquazip.a,quazip.dll.


5. Create a new test program of your own.

Copy the header file used in Quazip to the test program and create a new zip folder to store





6. Add the following code to the My_zip_test.pro

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
}

7. Examples of use:

#include <QCoreApplication>
#include "JlCompress.h"

int main (int argc, char *argv[])
{
    Qcoreapplication A (argc, argv);

    Jlcompress::compressdir ("D:\\test.zip", "d:\\test"); Compress
    jlcompress::extractdir ("D:\\test.zip", "d:\\test");//Unzip
    return a.exec ();
}
At this point the program can compile successfully but will report: abnormal exit

8. Workaround:

The Quazip.dll and Quazipd.dll generated by the Quazip project are placed in the same directory as the release and debug versions My_zip_test.exe, and then the compilation run is OK.


if you want to directly use the compiled DLL and. A please go to the link to download, there is a simple small example:

http://download.csdn.net/detail/jing332/9557338

Please leave a message if you don't understand.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.