[Kde-finance-apps] [kde-finance-apps] Help getting more than one plugin to work?

Brian Cappello briancappello at gmail.com
Mon Jun 28 18:39:23 CEST 2010


Hi all,
I managed to get my sources to build, link/install, and load a single
plugin. But now, when I tried to add a second plugin in the same way as the
first, it doesn't work anymore. I think my problem is related to
Q_EXPORT_PLUGIN2?: "There should be exactly one occurrence of this macro in
the source code for a Qt plugin, and it should be used where the
implementation is written rather than in a header file." What defines "the
source code for a Qt plugin"? I assumed it would be one .cpp file, but, that
doesn't (experimentally) seem to be the case...?

The steps I took to get where I'm at:
1) code in svn works
2) copy symbolsuggesterplugin.* to companyinfoplugin.*
3) modify companyinfoplugin.* to inherent from plugininterfaces.h's
KeysInterface as opposed to SymbolSuggesterInterface [I can't seem to do
multiple inheritance because I needed to put a Q_OBJECT in each
plugininterfaces.h's virtual class definition so that plugins can work with
signals/slots... but then inheriting from two interface definitions means
inhering from two different QObjects, which Qt complains about. Any
suggestions for correct/better ways to keep signals/slots working in
plugins?]
4) add companyinfoplugin.* to CMake's set(SRCS) and
set(MOC_headers_to_build) --> that works; the 2nd plugin sources at least
compile w/out error
5) add the line ADD_LIBRARY(companyinfoplugin SHARED ${backend_SRCs}
${backend_MOC_SRCs} ) to cmake --> this is where things break

5a) error with the Q_EXPORT_PLUGIN2 at the end of both
symbolsuggesterplugin.cpp (where it worked before) and at the end of
companyinfoplugin.cpp:
CMakeFiles/quotebackend.dir/companyinfoplugin.cpp.o: In function
`qt_plugin_query_verification_data':

/home/brian/test/alkimia/alkquotes/backend/companyinfoplugin.cpp:234:
multiple definition of `qt_plugin_query_verification_data'
CMakeFiles/quotebackend.dir/symbolsuggesterplugin.cpp.o:/home/brian/test/alkimia/alkquotes/backend/symbolsuggesterplugin.cpp:241:
first defined here
CMakeFiles/quotebackend.dir/companyinfoplugin.cpp.o: In function
`qt_plugin_instance':
/home/brian/test/alkimia/alkquotes/backend/companyinfoplugin.cpp:234:
multiple definition of `qt_plugin_instance'
CMakeFiles/quotebackend.dir/symbolsuggesterplugin.cpp.o:/home/brian/test/alkimia/alkquotes/backend/symbolsuggesterplugin.cpp:241:
first defined here
CMakeFiles/quotebackend.dir/moc_companyinfoplugin.cxx.o:(.rodata._ZTV17CompanyInfoPlugin[vtable
for CompanyInfoPlugin]+0x80): undefined reference to
`CompanyInfoPlugin::humanReadableKeys(QStringList const&)'
collect2: ld returned 1 exit status
make[2]: *** [backend/quotebackend] Error 1
make[1]: *** [backend/CMakeFiles/quotebackend.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

5b) the error with the Q_EXPORT_PLUGIN2 line commented out in only
companyinfoplugin:
Waaaaay more lines than my console can handle, but essentially, i get
undefined references to (seemingly) every qt function/object/whatever like
so:

CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o: In function
`CompanyInfoPlugin::keysDownloaded(QString const&, QString const&,
QStringList const&, QStringList const&)':
/home/brian/test/alkimia/alkquotes/build/backend/moc_companyinfoplugin.cxx:97:
undefined reference to `QMetaObject::activate(QObject*, QMetaObject const*,
int, void**)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o: In function
`QList<QString>::detach_helper()':
/usr/include/QtCore/qlist.h:604: undefined reference to
`QListData::detach3()'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o: In function
`~QString':
/usr/include/QtCore/qstring.h:869: undefined reference to
`QString::free(QString::Data*)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o: In function
`QList<QString>::free(QListData::Data*)':
/usr/include/QtCore/qlist.h:649: undefined reference to `qFree(void*)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable
for CompanyInfoPlugin]+0x38): undefined reference to
`QObject::event(QEvent*)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable
for CompanyInfoPlugin]+0x40): undefined reference to
`QObject::eventFilter(QObject*, QEvent*)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable
for CompanyInfoPlugin]+0x48): undefined reference to
`QObject::timerEvent(QTimerEvent*)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable
for CompanyInfoPlugin]+0x50): undefined reference to
`QObject::childEvent(QChildEvent*)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable
for CompanyInfoPlugin]+0x58): undefined reference to
`QObject::customEvent(QEvent*)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable
for CompanyInfoPlugin]+0x60): undefined reference to
`QObject::connectNotify(char const*)'
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable
for CompanyInfoPlugin]+0x68): undefined reference to
`QObject::disconnectNotify(char const*)'

Anybody got any ideas? I committed the files to svn for reference and left
the code at step 4 so that it compiles without error.
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-finance-apps/attachments/20100628/920ae163/attachment.htm 


More information about the Kde-finance-apps mailing list