Hi everybody, <br>I&#39;ve been trying to get plugins working, but to no avail. To start small extremely small, here&#39;s a simple plugin I&#39;m trying to make. I keep getting linker errors, I was hoping maybe somebody could pick up on something I&#39;m missing? Below are the files and the error I&#39;m getting. I&#39;ve already wasted a fair bit of time on this, so, what are people&#39;s opinions on maybe scrapping the idea of plugins in the short term? Originally I figured it best to get them working early, but at this point, I feel it&#39;s seriously beginning to hinder progress...<br>
<br>Thanks in advance for any input :)<br><br>***** interfaces.h ******************************<br>class KeysInterface<br>{  <br>  public:<br>    virtual ~KeysInterface();<br>    virtual QStringList keys() const = 0;  <br>
};<br>Q_DECLARE_INTERFACE( KeysInterface,<br>             &quot;org.kde.quotebackend.KeysInterface/1.0&quot; );<br><br>***** testplugin.h *****************************<br>#ifndef TEST_PLUGIN_H<br>#define TEST_PLUGIN_H<br>
#include &lt;QObject&gt;<br>#include &lt;QStringList&gt;<br>#include &quot;interfaces.h&quot;<br>class KeysInterface;<br><br>class TestPlugin : public QObject, public KeysInterface<br>{<br>  Q_OBJECT<br>  Q_INTERFACES(KeysInterface)<br>
 <br>  public:<br>    virtual ~TestPlugin() {}<br>    <br>    QStringList keys() const;<br>};<br>#endif<br><br>***** testplugin.cpp ***********************<br>#include &quot;testplugin.h&quot;<br>QStringList TestPlugin::keys() const<br>
{<br>  return QStringList() &lt;&lt; &quot;This&quot; &lt;&lt; &quot;Plugin&quot; &lt;&lt; &quot;Appears&quot; &lt;&lt; &quot;To&quot; &lt;&lt; &quot;Work&quot;;<br>}<br>Q_EXPORT_PLUGIN2(testplugin, TestPlugin);<br><br>**** cmake ******************************<br>
cmake_minimum_required( VERSION 2.6 )<br>PROJECT( quotebackend )<br><br>FIND_PACKAGE( Qt4 REQUIRED )<br>SET( QT_USE_QTSQL true )<br>SET( QT_USE_QTDBUS true )<br>SET( QT_USE_QTNETWORK true )<br>SET( QT_USE_QTSCRIPT true )<br>
<br>INCLUDE( ${QT_USE_FILE} )<br>ADD_DEFINITIONS( ${QT_DEFINITIONS} )<br>ADD_DEFINITIONS( -DQT_PLUGIN )<br>ADD_DEFINITIONS( -DQT_SHARED )<br>INCLUDE_DIRECTORIES( ${QT_INCUDE_DIR} <br>             ${QT_QTNETWORK_INCLUDE_DIR} <br>
             ${QDBUS_INCLUDE_DIRS} <br>             ${QT_QTSQL_INCLUDE_DIR} )<br><br>SET( backend_SRCs<br>     main.cpp<br>     backend.cpp<br>     symbolmanager.cpp<br>     statsmanager.cpp<br>     downloader.cpp <br>     testplugin.cpp<br>
      )<br><br># set all QObjects to have their MOC files generated<br>SET( backend_MOC_Headers<br>     plugininterfaces.h<br>     testplugin.h<br>     backend.h<br>     symbolmanager.h<br>     statsmanager.h<br>     downloader.h <br>
      )<br><br>QT4_WRAP_CPP( backend_MOC_SRCs ${backend_MOC_Headers} )<br><br># setup cmake to automatically generate dbus adaptor objects<br>QT4_ADD_DBUS_ADAPTOR( backend_SRCs org.kde.quotebackend.symbolmanager.xml symbolmanager.h SymbolManager )<br>
QT4_ADD_DBUS_ADAPTOR( backend_SRCs org.kde.quotebackend.statsmanager.xml statsmanager.h StatsManager )<br><br>#SET( PLUGIN_SRCS<br> #    testplugin.cpp<br>#    )<br><br>#SET( PLUGIN_MOC_HEADERS<br>   #  testplugin.h<br>  #   plugininterfaces.h<br>
 #   )<br><br>#QT4_WRAP_CPP( PLUGIN_MOC_SRCS ${PLUGIN_MOC_HEADERS} )<br>#ADD_LIBRARY(testplugin SHARED ${PLUGIN_SRCS} ${PLUGIN_MOC_SRCS}) # /me thinks this is the problem? I sniped this line from<br># a project i found using qt, cmake, and plugins but yea, it doesn&#39;t work<br>
ADD_LIBRARY(testplugin SHARED ${backend_SRCs} ${backend_MOC_SRCs}) #same error for the above line and this one. changing SHARED to MODULE doesn&#39;t work either<br><br>TARGET_LINK_LIBRARIES( testplugin ${DEFAULT_PLUGIN_SUBDIR}) #same error with or without this line<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># install the adaptor xml description files so clients can build against them (is --prefix/interfaces the correct place for these?)<br>
FILE(GLOB adaptorfiles &quot;${CMAKE_CURRENT_SOURCE_DIR}/*.xml&quot;)<br>INSTALL(FILES ${adaptorfiles} DESTINATION interfaces)<br><br>***** error **************<br>Linking CXX executable quotebackend<br>CMakeFiles/quotebackend.dir/moc_testplugin.cxx.o: In function `~TestPlugin&#39;:                                                                                                                                                                                                          <br>
/home/brian/quotebackend/build/backend/../../backend/testplugin.h:19: undefined reference to `KeysInterface::~KeysInterface()&#39;<br>/home/brian/quotebackend/build/backend/../../backend/testplugin.h:19: undefined reference to `KeysInterface::~KeysInterface()&#39;<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: *** [all] Error 2<br>