[Interest] How to deploy a qml app with Qt built statically?

Nuno Santos nunosantos at imaginando.pt
Fri May 22 18:59:20 CEST 2015


Thiago,

After reading about it on:

http://doc.qt.io/qt-5/qtplugin.html

In .pro file I have added:

QTPLUGIN += qwindows

And in one of the source files I have added:

#include <QtPlugin>

Q_IMPORT_PLUGIN(qwindows)

And the result was:

error LNK2019: unresolved external symbol "struct QStaticPlugin const 
__cdecl qt_static_plugin_qwindows(void)" 
(?qt_static_plugin_qwindows@@YA?BUQStaticPlugin@@XZ) referenced in 
function "public: __thiscall 
StaticqwindowsPluginInstance::StaticqwindowsPluginInstance(void)" 
(??0StaticqwindowsPluginInstance@@QAE at XZ)

Sorry, but i'm lost here.

Regards,

Nuno

On 22/05/2015 17:44, Thiago Macieira wrote:
> On Friday 22 May 2015 16:37:27 Nuno Santos wrote:
>> Hi,
>>
>> I have compiled Qt statically. In this process I have found two
>> difficulties:
>>
>> - If I don't compile it with -developer-build I don't have the plugins
>> compiled
> That's a bug, please report.
>
>> - When I finally got plugins compiled, they are static libs
> Of course.
>
>> When my program is about to start it asks about plugin windows (i assume
>> it is the platforms/qwindows.dll)
> Which is a static library that you need to link into your application. Qmake
> has some logic to automatically process staticplugins.
>
>> What is the process to deploy an application with a static build of qt?
> Try a lot and figure it out for the plugins. Make sure they are getting linked
> into your binary and make sure they are getting initialised too. For each
> staticplugin, qmake should generate an extra .cpp file that calls a function
> from the plugin to register itself.
>
> In order to do that, you need to list all plugins you want to use in a
> variable (I don't remember the name, it must be in the docs).
>




More information about the Interest mailing list