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":http://rapidshare.com/files/4200075700/Multi-Download.rar

    In .pro
    @CONFIG += static

    RESOURCES +=
    Dossier.qrc@

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

    In Dossier.qrc (i've read about .rc... don't know the difference..)
    @<RCC>
    <qresource prefix="/icons">
    <file>Tatice-Browsers-Download.ico</file>
    <file>Benjigarner-Softdimension-7zip.ico</file>
    <file>Iconmoon-Web-Application-Load.ico</file>
    <file>Iconmoon-Web-Application-Save.ico</file>
    <file>Saki-Snowish-Extras-internet-download.ico</file>
    </qresource>
    <qresource prefix="/7Zip">
    <file>7z.dll</file>
    <file>7z.exe</file>
    <file>7z.sfx</file>
    <file>7zCon.sfx</file>
    <file>7zFM.exe</file>
    <file>7zG.exe</file>
    <file>7-zip.chm</file>
    <file>7-zip.dll</file>
    <file>descript.ion</file>
    <file>History.txt</file>
    <file>License.txt</file>
    <file>readme.txt</file>
    </qresource>
    </RCC>@

    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.
    Thanks



  • Up!



  • You have to initialize the resource with the base name of your qrc file
    @
    Q_INIT_RESOURCE(Dossier)
    @



  • 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) :
    .pro:
    @QTPLUGIN += qico
    LIBS += "G:\Qt\4.8.3\plugins\imageformats"@
    main.cpp:
    @#include <QtPlugin>
    Q_IMPORT_PLUGIN(qico)@

    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
 

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