Ah, thanks, that worked. But now I have a new problem; the executable can't find the plugin?<br>**** cmake *************<br>ADD_LIBRARY(testplugin SHARED ${backend_SRCs} ${backend_MOC_SRCs})<br><br>ADD_EXECUTABLE( quotebackend ${backend_SRCs} ${backend_MOC_SRCs} )<br>
TARGET_LINK_LIBRARIES( quotebackend ${QT_LIBRARIES} )<br>INSTALL( TARGETS quotebackend ${INSTALL_TARGETS_DEFAULT_ARGS} DESTINATION bin )<br><br>TARGET_LINK_LIBRARIES( testplugin ${QT_LIBRARIES} )<br><br>INSTALL( TARGETS testplugin LIBRARY DESTINATION plugins )<br>
***** calling function ********<br>void StatsManager::loadPlugins()<br>{<br> QDir pluginsDir( QCoreApplication::applicationDirPath() );<br> qDebug() << "plugin path=" + pluginsDir.path();<br> if( !pluginsDir.cd("plugins") )<br>
{<br> qDebug() << "couldn't find plugin dir";<br> return;<br> }<br> <br> foreach( QString filename, pluginsDir.entryList(QDir::Files) )<br> {<br> QPluginLoader loader( pluginsDir.absoluteFilePath(filename) );<br>
if( KeysInterface *interface = qobject_cast<KeysInterface *>(loader.instance()) )<br> {<br> interfaces.append(interface);<br> qDebug() << "successfully loaded test plugin";<br> }<br>
} <br>}<br>**** runtime error ********<br>"couldn't find plugin dir"<br><br>And indeed, it doesn't exist. Where should the plugin get installed to / how do I tell cmake to install there / how do I tell the executable to look there?<br>
<br><div class="gmail_quote">On Sun, Jun 27, 2010 at 5:03 PM, Fernando Vilas <span dir="ltr"><<a href="mailto:fvilas@iname.com">fvilas@iname.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Sunday, June 27, 2010 15:44:04 Brian Cappello wrote:<br>
> Hi everybody,<br>
> I've been trying to get plugins working, but to no avail. To start small<br>
> extremely small, here's a simple plugin I'm trying to make. I keep getting<br>
> linker errors, I was hoping maybe somebody could pick up on something I'm<br>
> missing? Below are the files and the error I'm getting.<br>
</div>[...]<br>
><br>
> virtual ~KeysInterface();<br>
[...]<br>
> virtual ~TestPlugin() {}<br>
><br>
[...]<br>
<div class="im">> ***** error **************<br>
> Linking CXX executable quotebackend<br>
> CMakeFiles/quotebackend.dir/moc_testplugin.cxx.o: In function<br>
> `~TestPlugin':<br>
><br>
> /home/brian/quotebackend/build/backend/../../backend/testplugin.h:19:<br>
> undefined reference to `KeysInterface::~KeysInterface()'<br>
> /home/brian/quotebackend/build/backend/../../backend/testplugin.h:19:<br>
> undefined reference to `KeysInterface::~KeysInterface()'<br>
><br>
<br>
</div>It's looking for the KeysInterface dtor body. You don't have one, so the<br>
linker never finds it. Look at the dtor for TestPlugin above.<br>
<font color="#888888"><br>
--<br>
Thanks,<br>
Fernando Vilas<br>
<a href="mailto:fvilas@iname.com">fvilas@iname.com</a><br>
</font><br>_______________________________________________<br>
Kde-finance-apps mailing list<br>
<a href="mailto:Kde-finance-apps@kde.org">Kde-finance-apps@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kde-finance-apps" target="_blank">https://mail.kde.org/mailman/listinfo/kde-finance-apps</a><br>
<br></blockquote></div><br>