[Kde-finance-apps] [kde-finance-apps] Qt Plugins + CMake linking help?

Brian Cappello briancappello at gmail.com
Sun Jun 27 23:23:42 CEST 2010


Ah, thanks, that worked. But now I have a new problem; the executable can't
find the plugin?
**** cmake *************
ADD_LIBRARY(testplugin SHARED ${backend_SRCs} ${backend_MOC_SRCs})

ADD_EXECUTABLE( quotebackend ${backend_SRCs} ${backend_MOC_SRCs} )
TARGET_LINK_LIBRARIES( quotebackend ${QT_LIBRARIES} )
INSTALL( TARGETS quotebackend ${INSTALL_TARGETS_DEFAULT_ARGS} DESTINATION
bin )

TARGET_LINK_LIBRARIES( testplugin ${QT_LIBRARIES}  )

INSTALL( TARGETS testplugin LIBRARY DESTINATION plugins )
***** calling function ********
void StatsManager::loadPlugins()
{
  QDir pluginsDir( QCoreApplication::applicationDirPath() );
  qDebug() << "plugin path=" + pluginsDir.path();
  if( !pluginsDir.cd("plugins") )
  {
    qDebug() << "couldn't find plugin dir";
    return;
  }

  foreach( QString filename, pluginsDir.entryList(QDir::Files) )
  {
    QPluginLoader loader( pluginsDir.absoluteFilePath(filename) );
    if( KeysInterface *interface = qobject_cast<KeysInterface
*>(loader.instance()) )
    {
      interfaces.append(interface);
      qDebug() << "successfully loaded test plugin";
    }
  }
}
**** runtime error ********
"couldn't find plugin dir"

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?

On Sun, Jun 27, 2010 at 5:03 PM, Fernando Vilas <fvilas at iname.com> wrote:

> On Sunday, June 27, 2010 15:44:04 Brian Cappello wrote:
> > Hi everybody,
> > I've been trying to get plugins working, but to no avail. To start small
> > extremely small, here's a simple plugin I'm trying to make. I keep
> getting
> > linker errors, I was hoping maybe somebody could pick up on something I'm
> > missing? Below are the files and the error I'm getting.
> [...]
> >
> >     virtual ~KeysInterface();
> [...]
> >     virtual ~TestPlugin() {}
> >
> [...]
> > ***** error **************
> > Linking CXX executable quotebackend
> > CMakeFiles/quotebackend.dir/moc_testplugin.cxx.o: In function
> > `~TestPlugin':
> >
> > /home/brian/quotebackend/build/backend/../../backend/testplugin.h:19:
> > undefined reference to `KeysInterface::~KeysInterface()'
> > /home/brian/quotebackend/build/backend/../../backend/testplugin.h:19:
> > undefined reference to `KeysInterface::~KeysInterface()'
> >
>
> It's looking for the KeysInterface dtor body. You don't have one, so the
> linker never finds it. Look at the dtor for TestPlugin above.
>
> --
> Thanks,
> Fernando Vilas
> fvilas at iname.com
>
> _______________________________________________
> Kde-finance-apps mailing list
> Kde-finance-apps at kde.org
> https://mail.kde.org/mailman/listinfo/kde-finance-apps
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-finance-apps/attachments/20100627/83923194/attachment.htm 


More information about the Kde-finance-apps mailing list