Important: Please read the Qt Code of Conduct -

[SOLVED] Qt static missing icon plugin

  • Hi all,

    I'm new to qt and tried to compile my first app 2 days ago everything went fine, but had to build a static version of Qt to embed dlls with my app.
    I religiously followed the processed described @
    Now, the app has all the required dlls in but the icons are ignored. The window icon, app icon, even a QPushButton icon are not present when compiled with the static build.
    Could any of you share his light and tell me want I have forgotten (because let's face though it's hard to say I've forgotten something)


  • Welcome to devnet

    I am wondering what your actual problems is? Can you show please what you like to see and what you see?
    If you are using your own icons they are no part of the static library build.

    PS: Just as terminology note. A static build does not have dlls in there. In a static build all routines and methods are compiled and in a static library. The functionality as otherwise in the dlls is now in the static lib rather than in a dll.

  • You must link the imageformat plugins statically to your application too (they cannot be loaded dynamically during runtime as with the shared lib version).

    See for the details, please. The actual set of imageformat plugins to link depends on your icons and other graphics you use.

  • Thanks for your help

    So basically what has to be done is:

    in .pro file :
    add QTPLUGIN += qico
    add LIBS += path to qico parent folder

    in main.cpp
    add #include <QtPlugin>
    add Q_IMPORT_PLUGIN(qico)

    that's it.

    thanks again

  • Ie_gweg,

    I've exactly the same problem.
    I've followed your instructions, but still I have a problem. It is related to the LIBS row in the .pro file.
    I have found in the directory structure of my static qt "pico.prl" (whatever prl means) here:

    If I add in the .pro file
    LIBS +=c:\Qt\static\5.2.1\plugins\imageformats

    I get the following error:

    cannot find LIBS +=c:\Qt\static\5.2.1\plugins\imageformats: Permission denied

    The same occurs if I repeat the procedure, but indicating the path file up to plugins (i.e. excluding imageformats).

    Can you, please, advise?
    Thanks a lot.

  • Sorry,
    it was very easy!
    I use Qt 5.2.1.

    The only thing it was needed is to add in file
    QTPLUGIN += qico

    There was non need for LIBS, nor for the macro in main().

    Thanks, anyway.

Log in to reply