Important: Please read the Qt Code of Conduct -

Static Build Using Plugins Problem

  • Hello,

    I'm trying to build against a static qt build but get the error:

    main.obj:-1: error: LNK2019: unresolved external symbol "class QObject * __cdecl qt_plugin_instance_qjpeg(void)" (?qt_plugin_instance_qjpeg@@YAPAVQObject@@XZ) referenced in function "public: __thiscall StaticqjpegPluginInstance::StaticqjpegPluginInstance(void)" (??0StaticqjpegPluginInstance@@QAE@XZ)

    My .pro file has:

    CONFIG += static
    static {
    QTPLUGIN += qjpeg

    My main has:

    #ifdef STATIC_BUILD
    #include <QtPlugin>

    qjpeg4.lib in plugins/imageformats is being linked against because if I change the name, I get a link error.

    Qt 4.8.0 was configured with: configure -static -shared -qt-libjpeg

    I'm using QtCreator and msvc2008.

    I see this problem mentioned a few times in the forum, but I've checked everything that I know of. Any Ideas?

    [EDIT: code formatting, please wrap in @-tags, Volker]

  • I did a dumpbin /EXPORTS on qjpeg4.lib and the only symbols are:


    So, I don't see how the linker will find qt_plugin_instance_qjpeg.

    Any ideas?

Log in to reply