QuaZip Import
-
Hey!
I stuck on some other libraries but I think that QuaZip is still the best one cuz it delivers me more. What I tried was to include the source code into the project but that didn't work. How have you added QuaZip to your project? I have this "undefined reference" problem for days and I tried many solutions so I just want to end up this whole thing by implementing QuaZip into my project. I'm thankful to all who try to deliver me a reliable solution.
-
QuaZip as almost every other zip library is just a wrapper around zlib so I'm not sure you can call one better than the other. Personally I'm a fan of KArchive as it manages other formats, not just the zip one.
Now to the core of your question.
Compile QuaZip and then add it as an external library.If you decide to use KArchive instead the building of the library can be a bit overwhelming the first time so you can downloand a pre-compiled version (including all the dependencies) for MSVC2019 from here (x64/x86)
-
@FluentCoding said in QuaZip Import:
So I have to use MSVC2019 to compile my project when using KArchive
If you use my pre-compiled version, yes
-
Instructions do not include the optional liblzma as it would need some testing on my part and I don't have MinGW on my pc atm.
- install CMake if you don't have it already (https://cmake.org/)
- install git if you don't have it already (https://git-scm.com/)
- start a command prompt (cmd.exe), all the instructions beyond this point need to be run inside this cmd terminal
- type
cmake --version
. if an error appears, callset PATH=path\to\cmake\bin;%PATH%
wherepath/to/cmake/bin
is the path to the bin folder of CMake (for me it's C:\Program Files\CMake\bin). Runcmake --version
again to confirm no more errors - type
git --version
. if an error appears, callset PATH=path\to\git\bin;%PATH%
wherepath/to/git/bin
is the path to the bin folder of git(for me it's C:\Program Files\Git\bin). Rungit --version
again to confirm no more errors cd
into the bin folder of Qt (for me it's C:\Qt\5.15.0\msvc2019_64\bin)- call
qtenv2.bat
- cd into an empty folder and run these commands:
set CMAKEGENERATOR="MinGW Makefiles" git clone --depth=1 https://gitlab.com/federicomenaquintero/bzip2.git bzip2src cd .\bzip2src mkdir .\build cd .\build cmake -G %CMAKEGENERATOR% -DENABLE_LIB_ONLY=ON -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=../../bzip2 ../ cmake --build . --config Release cmake --build . --target install --config Release cd ..\..\ rmdir /Q /S bzip2src set PATH=%CD%\bzip2;%PATH% git clone --depth=1 https://github.com/madler/zlib.git zlibBuild cd zlibBuild mkdir .\build cd .\build cmake -G %CMAKEGENERATOR% -DCMAKE_INSTALL_PREFIX=../../zlib -DCMAKE_BUILD_TYPE=RELEASE ../ cmake --build . cmake --build . --target install cd ..\..\ rmdir /Q /S zlibBuild set PATH=%CD%\zlib;%PATH% git clone --depth=1 git://anongit.kde.org/extra-cmake-modules ECM cd ECM mkdir .\build cd .\build cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../ECMbuild -DCMAKE_BUILD_TYPE=RELEASE ../ cmake --build . cmake --build . --target install cd ..\..\ set PATH=%CD%\ECMbuild;%PATH% git clone --depth=1 git://anongit.kde.org/karchive.git KArchive cd KArchive mkdir .\build cd .\build cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=DEBUG ../ cmake --build . cmake --build . --target install cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=RELEASE ../ cmake --build . cmake --build . --target install cd ..\..\ rmdir /Q /S ECMbuild rmdir /Q /S ECM rmdir /Q /S KArchive
Now you should have 3 folders. KDEAPI will contain the KArchive to link to it in Qt Creator the other 2 will contain the dlls required by KArchive to function
-
@VRonin I got an error.
... in this step:
cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=DEBUG ../
(one of the last ones).Should I update the config file?
-
wow, that's a messy PATH, you have more than 3 versions of mingw and apparently 2 of Qt in there.
beforeset CMAKEGENERATOR="MinGW Makefiles"
runset PATH=C:\Program Files\CMake\bin;C:\Program Files\Git\cmd
.This hould get rid of the junk in there but you should really think about cleaning up that variable permanently from the variable editor removing stuff you don't need.
-
ok, let's start from scratch:
Now I know where you installed stuff so I can do it all in one script.
Open a new cmd window and run the following comands:set PATH=C:\Program Files\CMake\bin;C:\Program Files\Git\cmd set CMAKEGENERATOR="MinGW Makefiles" cd /D D:\dev\Qt\5.14.2\mingw73_64\bin qtenv2.bat cd /D C:\Users\einst\Desktop rmdir /Q /S KArchive mkdir KArchive cd KArchive git clone --depth=1 https://gitlab.com/federicomenaquintero/bzip2.git bzip2src cd .\bzip2src mkdir .\build cd .\build cmake -G %CMAKEGENERATOR% -DENABLE_LIB_ONLY=ON -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=../../bzip2 ../ cmake --build . --config Release cmake --build . --target install --config Release cd ..\..\ rmdir /Q /S bzip2src set PATH=%CD%\bzip2;%PATH% git clone --depth=1 https://github.com/madler/zlib.git zlibBuild cd zlibBuild mkdir .\build cd .\build cmake -G %CMAKEGENERATOR% -DCMAKE_INSTALL_PREFIX=../../zlib -DCMAKE_BUILD_TYPE=RELEASE ../ cmake --build . cmake --build . --target install cd ..\..\ rmdir /Q /S zlibBuild set PATH=%CD%\zlib;%PATH% git clone --depth=1 git://anongit.kde.org/extra-cmake-modules ECM cd ECM mkdir .\build cd .\build cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../ECMbuild -DCMAKE_BUILD_TYPE=RELEASE ../ cmake --build . cmake --build . --target install cd ..\..\ set PATH=%CD%\ECMbuild;%PATH% git clone --depth=1 git://anongit.kde.org/karchive.git KArchive cd KArchive mkdir .\build cd .\build cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=DEBUG ../ cmake --build . cmake --build . --target install cmake -G %CMAKEGENERATOR% -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../KDEAPI -DCMAKE_BUILD_TYPE=RELEASE ../ cmake --build . cmake --build . --target install cd ..\..\ rmdir /Q /S ECMbuild rmdir /Q /S ECM rmdir /Q /S KArchive
-
@VRonin Nah, I'm giving up tbh. I get errors and erros and even then, is it worth it? I mean I just want to download a zip from my application and extract it from memory, but it wouldnt be so hard for the computer that it saves the zip into local storage and then extracts it from there. Also, I have an ETA for my application that I set myself. :/ But thank you so much for your help! I owe you..