[Qt-interest] Undefined symbol error when using singleton class with Qt plugins
Bo Thorsen
bo at fioniasoftware.dk
Fri Jan 14 09:19:31 CET 2011
Den 14-01-2011 07:13, Andreas Unger skrev:
> Hi all,
>
> Attached please find a small test project consisting of a singleton
> class with two public methods: testString() and printTestString()
>
> The plugin in the project has only one method in its interface:
> printTestString();
>
> When Singleton::printTestString is called,
> TestPlugin::printTestString() is called in turn. The string that is
> printed in the plugin is this: Singleton::instance()->testString()
>
> Could someone please help me figure out why I get this error when I
> try to run the code:
>
> ./Test: symbol lookup error: libtestplugin.so: undefined symbol:
> _ZN9Singleton8instanceEv
>
> It seems likes the symbol relating to the static Singleton::instance()
> method is undefined. How could I fix this? I would really appreciate
> your input.
The problem is that your plugin uses a concrete class but doesn't have
the symbols compiled in.
When you have a class that's used in both the main application and the
plugins, you should put it in a library and have both of them link to it.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
More information about the Qt-interest-old
mailing list