jimboqt
5th July 2007, 10:44
Hi all,
I'm fairly new to Qt. I'm trying to compile my example plugin and I'm getting the following linker errors: -
release\exampleimportplugin.o(.text+0x4f):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
release\exampleimportplugin.o(.text+0x81):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0xda):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x114):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
release\exampleimportplugin.o(.text+0x146):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x19f):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x1f8):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x237):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
release\exampleimportplugin.o(.text+0x264):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x2bd):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x316):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x36f):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x600):example importplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
release\exampleimportplugin.o(.text+0xf0e):example importplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
release\exampleimportplugin.o(.text+0x1420):exampl eimportplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
release\exampleimportplugin.o(.text+0x1d2e):exampl eimportplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
release\moc_exampleimportplugin.o(.text+0xe2):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::qt_metacall(QMetaObject: :Call, int, void**)'
release\moc_exampleimportplugin.o(.text+0x9d):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::qt_metacast(char const*)'
release\moc_exampleimportplugin.o(.rdata+0x0):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::staticMetaObject'
release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD1Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x183):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
entation'
release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD1Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x39c):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
entation'
release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD0Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x183):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
entation'
release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD0Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x3ac):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
entation'
collect2: ld returned 1 exit status
I've cleaned the project, then I'm using qmake, then mingw32-make. Here's my .pro file:
TEMPLATE = lib
CONFIG += plugin
TARGET = example
DESTDIR = ../../../../bin/importers
DEPENDPATH += .
INCLUDEPATH += ../../../../include
# Input
HEADERS += exampleimportplugin.h
SOURCES += exampleimportplugin.cpp
Here's the code:
ExampleImportPlugin.h:
#include <QtPlugin>
#include <CPIImportDescriptor.h> // in include path
#include <CPIImportImplementation.h> // in include path
class ExampleImportPlugin : public CPIImportDescriptor, public CPIImportImplementation
{
Q_OBJECT
Q_INTERFACES(CPIImportDescriptor CPIImportImplementation)
public:
...
private:
...
};
ExampleImportPlugin.cpp:
#include "exampleimportplugin.h"
ExampleImportPlugin::ExampleImportPlugin()
{
...
}
bool ExampleImportPlugin::go()
{
...
}
Q_EXPORT_PLUGIN2( example, ExampleImportPlugin );
CPIImportImplementation.h:
#include <QObject>
#include <QList>
#include <QString>
class CPIImportImplementation : public QObject
{
Q_OBJECT
public:
CPIImportImplementation()
: myIsCancelled( false )
{
}
virtual bool go() = 0;
virtual ~CPIImportImplementation() {}
bool isCancelled() { return myIsCancelled; }
QString status() { return myStatus; }
QList<QString> & steps() { return mySteps; }
public slots:
void slot_cancelled() { myIsCancelled = true; }
signals:
void signal_newStep( const unsigned int numSubSteps );
void signal_setStep( const unsigned int step, const unsigned int numSubSteps );
void signal_newSubStep( const QString & status );
void signal_setSubStep( const unsigned int step, const QString & status );
protected:
QList<QString> mySteps;
QString myStatus;
private:
bool myIsCancelled;
};
Q_DECLARE_INTERFACE( CPIImportImplementation, "co.uk.cabos.Plugin.CPIImportImplementation/1.0" );
CPIImportDescriptor.h:
#include <QObject>
class CPIImportDescriptor
{
public:
...
protected:
...
private:
...
};
Q_DECLARE_INTERFACE( CPIImportDescriptor, "CABOS.Plugin.CPIImportDescriptor/1.0" );
Any ideas what I'm doing wrong?
Many thanks,
jimbo
I'm fairly new to Qt. I'm trying to compile my example plugin and I'm getting the following linker errors: -
release\exampleimportplugin.o(.text+0x4f):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
release\exampleimportplugin.o(.text+0x81):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0xda):examplei mportplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x114):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
release\exampleimportplugin.o(.text+0x146):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x19f):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x1f8):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x237):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newStep(unsigned int)'
release\exampleimportplugin.o(.text+0x264):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x2bd):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x316):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x36f):example importplugin.cpp: undefined reference to `CPIImportImplementation::signal_newSubStep(QStrin g const&)'
release\exampleimportplugin.o(.text+0x600):example importplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
release\exampleimportplugin.o(.text+0xf0e):example importplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
release\exampleimportplugin.o(.text+0x1420):exampl eimportplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
release\exampleimportplugin.o(.text+0x1d2e):exampl eimportplugin.cpp: undefined reference to `vtable for CPIImportImplementation'
release\moc_exampleimportplugin.o(.text+0xe2):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::qt_metacall(QMetaObject: :Call, int, void**)'
release\moc_exampleimportplugin.o(.text+0x9d):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::qt_metacast(char const*)'
release\moc_exampleimportplugin.o(.rdata+0x0):moc_ exampleimportplugin.cpp: undefined reference to `CPIImportImplementation::staticMetaObject'
release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD1Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x183):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
entation'
release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD1Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x39c):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
entation'
release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD0Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x183):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
entation'
release\moc_exampleimportplugin.o(.text$_ZN19Examp leImportPluginD0Ev[ExampleImportPlugin::~ExampleImportPlugin()]+0x3ac):moc_exampleimportplugin.cpp: undefined reference to `vtable for CPIImportImplem
entation'
collect2: ld returned 1 exit status
I've cleaned the project, then I'm using qmake, then mingw32-make. Here's my .pro file:
TEMPLATE = lib
CONFIG += plugin
TARGET = example
DESTDIR = ../../../../bin/importers
DEPENDPATH += .
INCLUDEPATH += ../../../../include
# Input
HEADERS += exampleimportplugin.h
SOURCES += exampleimportplugin.cpp
Here's the code:
ExampleImportPlugin.h:
#include <QtPlugin>
#include <CPIImportDescriptor.h> // in include path
#include <CPIImportImplementation.h> // in include path
class ExampleImportPlugin : public CPIImportDescriptor, public CPIImportImplementation
{
Q_OBJECT
Q_INTERFACES(CPIImportDescriptor CPIImportImplementation)
public:
...
private:
...
};
ExampleImportPlugin.cpp:
#include "exampleimportplugin.h"
ExampleImportPlugin::ExampleImportPlugin()
{
...
}
bool ExampleImportPlugin::go()
{
...
}
Q_EXPORT_PLUGIN2( example, ExampleImportPlugin );
CPIImportImplementation.h:
#include <QObject>
#include <QList>
#include <QString>
class CPIImportImplementation : public QObject
{
Q_OBJECT
public:
CPIImportImplementation()
: myIsCancelled( false )
{
}
virtual bool go() = 0;
virtual ~CPIImportImplementation() {}
bool isCancelled() { return myIsCancelled; }
QString status() { return myStatus; }
QList<QString> & steps() { return mySteps; }
public slots:
void slot_cancelled() { myIsCancelled = true; }
signals:
void signal_newStep( const unsigned int numSubSteps );
void signal_setStep( const unsigned int step, const unsigned int numSubSteps );
void signal_newSubStep( const QString & status );
void signal_setSubStep( const unsigned int step, const QString & status );
protected:
QList<QString> mySteps;
QString myStatus;
private:
bool myIsCancelled;
};
Q_DECLARE_INTERFACE( CPIImportImplementation, "co.uk.cabos.Plugin.CPIImportImplementation/1.0" );
CPIImportDescriptor.h:
#include <QObject>
class CPIImportDescriptor
{
public:
...
protected:
...
private:
...
};
Q_DECLARE_INTERFACE( CPIImportDescriptor, "CABOS.Plugin.CPIImportDescriptor/1.0" );
Any ideas what I'm doing wrong?
Many thanks,
jimbo