dimanche 27 mars 2016

Q_IMPORT_PLUGIN, how many times can I use it?

I'm trying to build a plugin app, an app which loads some plugins... I've played a little with dynamic loading and everything was fine. Now I'm playing with static loading... and I'm stuck in the following situation:

I have two plugins, the app works with both, but not with both at the same time. In main.cpp I have:

Q_IMPORT_PLUGIN(RawPlugin)
Q_IMPORT_PLUGIN(BPlugin)

and in the .pro:

LIBS           = -L../../plugins-static -lraw
LIBS           = -L../../plugins-static -lb

With the above configuration, I get:

In function `ZN29StaticRawPluginPluginInstanceC1Ev':
C:\Users\User\Downloads\thething\source\app\build-static/../main.cpp:7: undefined reference to `qt_static_plugin_RawPlugin()'
collect2.exe: error: ld returned 1 exit status
Makefile.Debug:78: recipe for target 'debug\app.exe' failed
mingw32-make[1]: *** [debug\app.exe] Error 1

Commenting any of the Q_IMPORT_PLUGIN, and the corresponding LIBS, lines make it work.

What I'm doing wrong?

Aucun commentaire:

Enregistrer un commentaire