Help with installing KArchive

Albert Astals Cid aacid at kde.org
Mon Feb 19 18:59:39 GMT 2024


El diumenge, 18 de febrer de 2024, a les 20:30:57 (CET), Eric Ribble va 
escriure:
> I am a new user of Qt (using version 6.6) and Qt Creator  I would like to
> use KArchive to extract all folders and files from a zip file.  I found the
> example "karchive/examples/unzipper/main.cpp" source code.  However, I
> don't know how to download and install KArchive. I added the following to
> my project's "CMakeLists.txt" as described on the web
> page https://marketplace.qt.io/pages/karchiveinstructionspage :
> find_package(KF5Archive)

Your are trying to use KF5 KArchive in a Qt6 application.

You can't do that, KF5 needs Qt5.

You can try using the KF6 beta release of KArchive or wait until we release 
KF6 at the end of the month.

> target_link_libraries(Example4 KF5::Archive)
> Attached is my "CMakeLists.txt" file and "Main.cpp" file.
> In my "Main.cpp" the syntax-checker indicates that it can't find "kzip.h"
> (probably because I don't know how to download/install it). Here is a
> screenshot after trying to build:
> 
> Please advise on how to properly download/install KArchive so that this
> simple program will build.  Thanks for your help! Eric Ribble

This is not a KDE question, this is a "I understand how compiling things with 
cmake works" question.

The usual answer is that you run cmake && ninja && ninja install (replace 
ninja by make or if you really don't have any of those by cmake commands that 
will build and install) in karchive and then point the cmake of your 
application to that folder you installed karchive, either via a command line 
option or by hardcoding the path in the CMakeLists.txt file.

But Windows developers don't like that so you may have luck doing a cmake 
submodule thing, but then you're on your own, that's generally not how we use 
libraries.

Cheers,
  Albert




More information about the kde-devel mailing list