Hi,
i'm trying to use signals and slots in plugins that will be loaded at runtime. But the plugins fails to load and i get this message:
"QLibrary::load_sys: Cannot load libvectorplugin.so.1.0.0 (libvectorplugin.so.1.0.0: undefined symbol: _ZN10App4Calcs11ICalculator10metaObjectEv)"
The plugin contains implementations of the following interfaces:
{
Q_OBJECT
public:
IView * createView() = 0;
(...)
signals:
void calculationDone();
};
class ICalculator : public QObject
{
Q_OBJECT
public:
IView * createView() = 0;
(...)
signals:
void calculationDone();
};
To copy to clipboard, switch view to plain text mode
{
Q_OBJECT
public:
(..)
public slots:
virtual void renderData() =0;
};
class IView : public QObject
{
Q_OBJECT
public:
(..)
public slots:
virtual void renderData() =0;
};
To copy to clipboard, switch view to plain text mode
and finally the plugin interface (the implementation of this inteface will be exported as a plugin):
class IPlugin
{
public:
ICalculator* createCalculator() = 0;
};
Q_DECLARE_INTERFACE(App::Calcs::IPlugin ,"IPlugin");
class IPlugin
{
public:
ICalculator* createCalculator() = 0;
};
Q_DECLARE_INTERFACE(App::Calcs::IPlugin ,"IPlugin");
To copy to clipboard, switch view to plain text mode
Implementation inside the plugin:
class VectorView : public IView
{
Q_OBJECT
public slots:
virtual void renderData()
{
(..)
}
};
class VectorView : public IView
{
Q_OBJECT
public slots:
virtual void renderData()
{
(..)
}
};
To copy to clipboard, switch view to plain text mode
class VectorCalculator : ICalculator
{
Q_OBJECT
public:
virtual void calculate()
{
(...)
emit calculationDone();
}
};
class VectorCalculator : ICalculator
{
Q_OBJECT
public:
virtual void calculate()
{
(...)
emit calculationDone();
}
};
To copy to clipboard, switch view to plain text mode
the qmake file:
TEMPLATE = lib
CONFIG += warn_on \
thread \
qt
TARGET = ../bin/vectorcalculator
QT += gui opengl
HEADERS += vectorcalculator.h
vectorview.h \
vectorplugin.h
SOURCES += vectorcalculator.cpp vectorview.cpp vectorplugin.cpp
TEMPLATE = lib
CONFIG += warn_on \
thread \
qt
TARGET = ../bin/vectorcalculator
QT += gui opengl
HEADERS += vectorcalculator.h
vectorview.h \
vectorplugin.h
SOURCES += vectorcalculator.cpp vectorview.cpp vectorplugin.cpp
To copy to clipboard, switch view to plain text mode
The compilation works fine. Why do i get this linker error at runtime?
thanks in advance!
Bookmarks