PDA

View Full Version : Nested Plugins



Luis Rodriguez
10th March 2006, 19:17
I'd like to create a plugin that uses another plugin. All of my plugins work fine on their own but when I try to use one from another, I get the following link error:

unresolved external symbol "public: static struct QMetaObject const FCSButton::staticMetaObject" (?staticMetaObject@FCSButton@@2UQMetaObject@@B)

FCSButton is a custom button plugin that I'd like to use inside of a custom spinbox plugin. The button works fine when using it in a regular widget in a normal app.

My guess is that the preprocessor definitions used to create a plugin are not compatible with using a plugin. It's telling the compiler to export the custom button when it should be importing it. But, I can't find the right combination of definitions to make it work.

I'm on Windows using Visual Studio 6 with QT 4.1.0-rc1

Thanks,
Luis Rodriguez

jacek
10th March 2006, 22:00
http://www.qtcentre.org/forum/showthread.php?t=638

In short:

In one plugin you must use something like this:
#ifdef CREATE_FIRST_PLUGIN
# define FIRST_PLUGIN_EXPORT Q_DECL_EXPORT
#else
# define FIRST_PLUGIN_EXPORT Q_DECL_IMPORT
#endif
while in second one:

#ifdef CREATE_SECOND_PLUGIN
# define SECOND_PLUGIN_EXPORT Q_DECL_EXPORT
#else
# define SECOND_PLUGIN_EXPORT Q_DECL_IMPORT
#endif
The CREATE_FIRST_PLUGIN and CREATE_SECOND_PLUGIN macros should be defined using DEFINES variable in the .pro files. This way you will be exporting symbols only from the DLL you are currently building, while other symbols will be imported.