Hi all,<br>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...?<br><br>The steps I took to get where I'm at:<br>
1) code in svn works<br>2) copy symbolsuggesterplugin.* to companyinfoplugin.*<br>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?]<br>
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<br>5) add the line ADD_LIBRARY(companyinfoplugin SHARED ${backend_SRCs} ${backend_MOC_SRCs} ) to cmake --> this is where things break<br>
<br>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:<br>CMakeFiles/quotebackend.dir/companyinfoplugin.cpp.o: In function `qt_plugin_query_verification_data': <br>
/home/brian/test/alkimia/alkquotes/backend/companyinfoplugin.cpp:234: multiple definition of `qt_plugin_query_verification_data'<br>CMakeFiles/quotebackend.dir/symbolsuggesterplugin.cpp.o:/home/brian/test/alkimia/alkquotes/backend/symbolsuggesterplugin.cpp:241: first defined here<br>
CMakeFiles/quotebackend.dir/companyinfoplugin.cpp.o: In function `qt_plugin_instance':<br>/home/brian/test/alkimia/alkquotes/backend/companyinfoplugin.cpp:234: multiple definition of `qt_plugin_instance'<br>CMakeFiles/quotebackend.dir/symbolsuggesterplugin.cpp.o:/home/brian/test/alkimia/alkquotes/backend/symbolsuggesterplugin.cpp:241: first defined here<br>
CMakeFiles/quotebackend.dir/moc_companyinfoplugin.cxx.o:(.rodata._ZTV17CompanyInfoPlugin[vtable for CompanyInfoPlugin]+0x80): undefined reference to `CompanyInfoPlugin::humanReadableKeys(QStringList const&)'<br>collect2: ld returned 1 exit status<br>
make[2]: *** [backend/quotebackend] Error 1<br>make[1]: *** [backend/CMakeFiles/quotebackend.dir/all] Error 2<br>make[1]: *** Waiting for unfinished jobs....<br><br>5b) the error with the Q_EXPORT_PLUGIN2 line commented out in only companyinfoplugin:<br>
Waaaaay more lines than my console can handle, but essentially, i get undefined references to (seemingly) every qt function/object/whatever like so:<br><br>CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o: In function `CompanyInfoPlugin::keysDownloaded(QString const&, QString const&, QStringList const&, QStringList const&)':<br>
/home/brian/test/alkimia/alkquotes/build/backend/moc_companyinfoplugin.cxx:97: undefined reference to `QMetaObject::activate(QObject*, QMetaObject const*, int, void**)'<br>CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o: In function `QList<QString>::detach_helper()':<br>
/usr/include/QtCore/qlist.h:604: undefined reference to `QListData::detach3()'<br>CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o: In function `~QString':<br>/usr/include/QtCore/qstring.h:869: undefined reference to `QString::free(QString::Data*)'<br>
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o: In function `QList<QString>::free(QListData::Data*)':<br>/usr/include/QtCore/qlist.h:649: undefined reference to `qFree(void*)'<br>CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable for CompanyInfoPlugin]+0x38): undefined reference to `QObject::event(QEvent*)'<br>
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable for CompanyInfoPlugin]+0x40): undefined reference to `QObject::eventFilter(QObject*, QEvent*)'<br>CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable for CompanyInfoPlugin]+0x48): undefined reference to `QObject::timerEvent(QTimerEvent*)'<br>
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable for CompanyInfoPlugin]+0x50): undefined reference to `QObject::childEvent(QChildEvent*)'<br>CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable for CompanyInfoPlugin]+0x58): undefined reference to `QObject::customEvent(QEvent*)'<br>
CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable for CompanyInfoPlugin]+0x60): undefined reference to `QObject::connectNotify(char const*)'<br>CMakeFiles/companyinfoplugin.dir/moc_companyinfoplugin.cxx.o:(.data.rel.ro._ZTV17CompanyInfoPlugin[vtable for CompanyInfoPlugin]+0x68): undefined reference to `QObject::disconnectNotify(char const*)'<br>
<br>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.<br>Thanks!<br>