Hello!
I'm trying to make an application which should be extensible using (lower-level, as guys from Trolltech call it) plugins.
I want to access the methods of my own classes in the plugin, which is a source of my problems. I can access methods of Qt classes in a plugin (if they are passed as a parameter), but I can not use methods of my class (although it is passed as a parameter, too).
When I found out that sth is wrong with the plugin system, I tried to modify the Plug&Paint example (to make sure if I didn't mess up sth with plugins), but that didn't work neither.
so here is what I have in a header file:
Q_OBJECT
public:
int sayHello(int a);
};
class myClass : public QObject {
Q_OBJECT
public:
int sayHello(int a);
};
To copy to clipboard, switch view to plain text mode
and the in a cpp file:
#include "myClass.h"
int myClass::sayHello(int a){
a += 30;
return a;
}
#include "myClass.h"
int myClass::sayHello(int a){
a += 30;
return a;
}
To copy to clipboard, switch view to plain text mode
I'm using slightly modified interfaces.h:
...
class FilterInterface
{
public:
virtual ~FilterInterface() {}
};
...
...
class FilterInterface
{
public:
virtual ~FilterInterface() {}
virtual QStringList filters() const = 0;
--> virtual QImage filterImage(const QString &filter, const QImage &image, myClass &cla, QWidget *parent) = 0;
};
...
To copy to clipboard, switch view to plain text mode
and in the plugin code (basictools.cpp):
{ int b = 50;
--> int a = cla.sayHello( b );
QImage result
= image.
convertToFormat(QImage::Format_RGB32);
QImage BasicToolsPlugin::filterImage(const QString &filter, const QImage &image, myClass &cla, QWidget * /* parent */)
{ int b = 50;
--> int a = cla.sayHello( b );
QImage result = image.convertToFormat(QImage::Format_RGB32);
To copy to clipboard, switch view to plain text mode
Everything compiles fine, but I get an error at runtime (when invoking a filter):
symbol lookup error: /home/.../bin/plugins/libpnp_basictools_debug.so: undefined symbol: _ZN7myClass8sayHelloEi
symbol lookup error: /home/.../bin/plugins/libpnp_basictools_debug.so: undefined symbol: _ZN7myClass8sayHelloEi
To copy to clipboard, switch view to plain text mode
I've looked up here on the forum, but I didn't find a topic about it, so could you please help me or just a post a link where sth like this is explained?
Thanx.
PS: I think it is the same problem as had a guy here, but nobody replied to him...:/
PS2: Compiling on Slack 10.2 with gcc 3.3.6 and Qt 4.1.3
Bookmarks