Important: Please read the Qt Code of Conduct -

Statically Compile Ressource File

  • First, English isn't my first language....
    I learned all i know about programmation on youtube so, if you have any ! any ! constructive comment, please write it, i will be very happy!
    My problem is that when i compile it dynamically, it's flawless, works like it's supposed to but, when i try to compile it in static mode, i get an error ([debug/qrc_Dossier.cpp] Error 2) that i can't find anywhere by googling it.

    i read a lot about (Error 1, file not found) an how to compile with only an image icon but, none of them worked for me.

    Link for all my program (Something near at least...): "Link":

    In .pro
    @CONFIG += static


    In main.cpp
    @int main(int argc, char *argv[])
    QApplication a(argc, argv);

    In Dossier.qrc (i've read about .rc... don't know the difference..)
    <qresource prefix="/icons">
    <qresource prefix="/7Zip">

    Thanks ALOT! for your help!

  • Did you compile your Qt as static library? Out of the box (from the downloadable, pre-compiled packages), it's always dynamic linking, as far as I know.

  • Yes, i've done this, there was an error with a file in debug mode but, i've compiled it sucessfully in realease mode by deleting the QRC File.

  • Up!

  • You have to initialize the resource with the base name of your qrc file

  • It doesn't solve it, i've got the exact same error...
    PS: i'm running Win 7 x64
    I tried including the static plugin (qico) :
    @QTPLUGIN += qico
    LIBS += "G:\Qt\4.8.3\plugins\imageformats"@
    @#include <QtPlugin>

    Yet, same exact error...
    i've even deleted from the container (.qrc) every file that were not .ico and, same error...
    :-1: error: [release/qrc_Dossier.cpp] Error 2
    Thanks for your reply!

Log in to reply