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.