Project ERROR: Unknown module(s) in QT: KArchive



  • After installing KArchive on my windows, I am still getting the error,

    Project ERROR: Unknown module(s) in QT: KArchive
    

    What should I do next please or what am I doing wrong?


  • Qt Champions 2018

    Hi @abdulmueez,

    • how did you install the library?
    • have you checked that the include files, lib and dll files have been copied to your Qt installations respective directories?
    • on Windows, you need separate files for debug and release builds. Can you check the other build type and see if that works?

    Regards



    • Installed it according to the instructions in the website https://wiki.qt.io/Karchive_on_windows

    • Do I have to manually include all the files, lib and dll and if yes, to which directories exactly?


  • Lifetime Qt Champion

    Hi,

    Can you share your .pro file ?



  • QT += quick xml svg KArchive
    CONFIG += c++11
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Refer to the documentation for the
    # deprecated API to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            epubcontainer.cpp \
            epubdocument.cpp \
            main.cpp
    
    RESOURCES += qml.qrc
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    HEADERS += \
        epubcontainer.h \
        epubdocument.h
    
    

  • Lifetime Qt Champion

    Did you check on your system for the presence of a KArchive.pri file ?



  • 0_1565558691725_Screenshot (28).png

    I found these 2 .pri files, Are they the ones ?



  • So, I found a possible solution that involves including the pri files in the pro file of my project,

    include(C:/Users/emiol/OneDrive/Desktop/Git/kaarchive/build/src/qt_KArchive.pri)
    

    These removes the above error, but I can't still make use of the headers(KZip,karchivedirectory,...), there files are not found.

    I think the errors are from the pri files, the headers ain't included in it, Here is the content

    QT.KArchive.VERSION = 5.61.0
    QT.KArchive.MAJOR_VERSION = 5
    QT.KArchive.MINOR_VERSION = 61
    QT.KArchive.PATCH_VERSION = 0
    QT.KArchive.name = KF5Archive
    QT.KArchive.module = KF5Archive
    QT.KArchive.defines = 
    QT.KArchive.includes = C:-DCMAKE_BUILD_TYPE=release/include/KF5/KArchive
    QT.KArchive.private_includes =
    QT.KArchive.libs = C:-DCMAKE_BUILD_TYPE=release/lib
    QT.KArchive.depends = core
    
    HEADERS +=
    
    ``

  • Lifetime Qt Champion

    Did you call make install after building the module ?



  • Yes, I did that



  • So, I manually added the files and I have this,
    I'm not sure I did the right thing, Is the format of the pri file correct now?
    This doesn't solve the error though, I just want to know whether I'm thinking in the right direction?

    QT.KArchive.VERSION = 5.61.0
    QT.KArchive.MAJOR_VERSION = 5
    QT.KArchive.MINOR_VERSION = 61
    QT.KArchive.PATCH_VERSION = 0
    QT.KArchive.name = KF5Archive
    QT.KArchive.module = KF5Archive
    QT.KArchive.defines = 
    QT.KArchive.includes = C:-DCMAKE_BUILD_TYPE=release/include/KF5/KArchive
    QT.KArchive.private_includes =
    QT.KArchive.libs = C:-DCMAKE_BUILD_TYPE=release/lib
    QT.KArchive.depends = core
    HEADERS +=\
        $$PWD/../../../../src/k7zip.h \
        $$PWD/../../../../src/kar.h \
        $$PWD/../../../../src/karchive.h \
        $$PWD/../../../../src/karchive_p.h \
        $$PWD/../../../../src/karchivedirectory.h \
        $$PWD/../../../../src/karchiveentry.h \
        $$PWD/../../../../src/karchivefile.h \
        $$PWD/../../../../src/kbzip2filter.h \
        $$PWD/../../../../src/kcompressiondevice.h \
        $$PWD/../../../../src/kcompressiondevice_p.h \
        $$PWD/../../../../src/kfilterbase.h \
        $$PWD/../../../../src/kfilterdev.h \
        $$PWD/../../../../src/kgzipfilter.h \
        $$PWD/../../../../src/klimitediodevice_p.h \
        $$PWD/../../../../src/knonefilter.h \
        $$PWD/../../../../src/krcc.h \
        $$PWD/../../../../src/ktar.h \
        $$PWD/../../../../src/kxzfilter.h \
        $$PWD/../../../../src/kzipfileentry.h
    
    SOURCES += \
        $$PWD/../../../../src/k7zip.cpp \
        $$PWD/../../../../src/kar.cpp \
        $$PWD/../../../../src/karchive.cpp \
        $$PWD/../../../../src/kbzip2filter.cpp \
        $$PWD/../../../../src/kcompressiondevice.cpp \
        $$PWD/../../../../src/kfilterbase.cpp \
        $$PWD/../../../../src/kfilterdev.cpp \
        $$PWD/../../../../src/kgzipfilter.cpp \
        $$PWD/../../../../src/klimitediodevice.cpp \
        $$PWD/../../../../src/knonefilter.cpp \
        $$PWD/../../../../src/krcc.cpp \
        $$PWD/../../../../src/ktar.cpp \
        $$PWD/../../../../src/kxzfilter.cpp \
        $$PWD/../../../../src/kzip.cpp
    
    

  • Qt Champions 2018

    Building KArchive on windows is not trivial and that article is badly out of date.
    You can download a pre-built version for MSVC2017 from here (expires in 6 months):

    Then unpack it and add the below to your project (.pro) file (this assumes you uncompressed the library in C:\KDE)

    LIBS += -LC:/KDE/lib
    INCLUDEPATH +=  C:/KDE/include/KF5/KArchive
    CONFIG(release, debug|release) {
    LIBS += -lKF5Archive
    }
    CONFIG(debug, debug|release) {
    LIBS += -lKF5Archived
    }
    


  • Thanks a lot, It works fine now.
    I really appreciate all thehelp


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.