Hey all,
I am trying to create a plugin for my program so i created a abstract class for an interface, i followed the echoplugin example. But the compiler keeps complaining about an "undefined reference to `vtable for ScrapperInterface'".
This is the complete error i get:
debug/moc_themoviedb.o: In function `~ScrapperInterface':
g:\projects\DuneInterface-build-desktop\ScrapperPlugins\TheMovieDb/../../../DuneInterface/movieWall/scrapperinterface.h:30: undefined reference to `vtable for ScrapperInterface'
collect2: ld returned 1 exit status
mingw32-make[3]: *** [debug/scrapperplugind.dll] Error 1
mingw32-make[2]: *** [debug] Error 2
mingw32-make[1]: *** [sub-TheMovieDb-make_default] Error 2
mingw32-make: *** [sub-ScrapperPlugins-make_default] Error 2
The process "E:\Qt\2010.05\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project DuneInterface (target: Desktop)
When executing build step 'Make'
debug/moc_themoviedb.o: In function `~ScrapperInterface':
g:\projects\DuneInterface-build-desktop\ScrapperPlugins\TheMovieDb/../../../DuneInterface/movieWall/scrapperinterface.h:30: undefined reference to `vtable for ScrapperInterface'
collect2: ld returned 1 exit status
mingw32-make[3]: *** [debug/scrapperplugind.dll] Error 1
mingw32-make[2]: *** [debug] Error 2
mingw32-make[1]: *** [sub-TheMovieDb-make_default] Error 2
mingw32-make: *** [sub-ScrapperPlugins-make_default] Error 2
The process "E:\Qt\2010.05\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project DuneInterface (target: Desktop)
When executing build step 'Make'
To copy to clipboard, switch view to plain text mode
This is the interface i have created:
#ifndef SCRAPPERINTERFACE_H
#define SCRAPPERINTERFACE_H
#include <QString>
#include "moviedetails.h"
class ScrapperInterface
{
public:
virtual ~ScrapperInterface() {}
virtual int getMovieDetails
(QString movieTitle
) = 0;
signals:
virtual int movieData();
};
Q_DECLARE_INTERFACE(ScrapperInterface,
"Esquirol.Plugin.Scrapper/1.0");
#endif // SCRAPPERINTERFACE_H
#ifndef SCRAPPERINTERFACE_H
#define SCRAPPERINTERFACE_H
#include <QString>
#include "moviedetails.h"
class ScrapperInterface
{
public:
virtual ~ScrapperInterface() {}
virtual QString siteName() = 0;
virtual QString siteAddress() = 0;
virtual int getMovieDetails(QString movieTitle) = 0;
signals:
virtual int movieData();
};
Q_DECLARE_INTERFACE(ScrapperInterface,
"Esquirol.Plugin.Scrapper/1.0");
#endif // SCRAPPERINTERFACE_H
To copy to clipboard, switch view to plain text mode
And this is the code for the plugin that implements the interface:
.h
#ifndef THEMOVIEDB_H
#define THEMOVIEDB_H
#include <QString>
#include <QObject>
#include <QXmlStreamReader>
#include <QtNetwork>
#include "themoviedb.h"
#include "scrapperinterface.h"
#include "moviedetails.h"
class TheMovieDb
: public QObject, ScrapperInterface
{
Q_OBJECT
Q_INTERFACES(ScrapperInterface)
public:
~TheMovieDb() {}
int getMovieDetails
(QString movieTitle
);
signals:
int movieData();
public slots:
void replyFinished(QNetworkReply *reply);
private:
void fetch();
static const QString apiKey
() { return "text";
}
QXmlStreamReader xml;
QNetworkAccessManager http;
};
#endif // THEMOVIEDB_H
#ifndef THEMOVIEDB_H
#define THEMOVIEDB_H
#include <QString>
#include <QObject>
#include <QXmlStreamReader>
#include <QtNetwork>
#include "themoviedb.h"
#include "scrapperinterface.h"
#include "moviedetails.h"
class TheMovieDb : public QObject, ScrapperInterface
{
Q_OBJECT
Q_INTERFACES(ScrapperInterface)
public:
~TheMovieDb() {}
QString siteName();
QString siteAddress();
int getMovieDetails(QString movieTitle);
signals:
int movieData();
public slots:
void replyFinished(QNetworkReply *reply);
private:
void fetch();
static const QString apiKey() { return "text"; }
QXmlStreamReader xml;
QNetworkAccessManager http;
};
#endif // THEMOVIEDB_H
To copy to clipboard, switch view to plain text mode
.cpp
#include "themoviedb.h"
#include <QDebug>
{
return "themoviedb.org";
}
{
return "http://www.themoviedb.org";
}
int TheMovieDb
::getMovieDetails(QString movieTitle
) {
qDebug() << "int TheMovieDb::getMovieDetails(QString movieTitle)";
return 0;
}
void TheMovieDb::replyFinished(QNetworkReply *reply)
{
qDebug() << "void TheMovieDb::replyFinished(QNetworkReply *reply)";
}
#include "themoviedb.h"
#include <QDebug>
QString TheMovieDb::siteName()
{
return "themoviedb.org";
}
QString TheMovieDb::siteAddress()
{
return "http://www.themoviedb.org";
}
int TheMovieDb::getMovieDetails(QString movieTitle)
{
qDebug() << "int TheMovieDb::getMovieDetails(QString movieTitle)";
return 0;
}
void TheMovieDb::replyFinished(QNetworkReply *reply)
{
qDebug() << "void TheMovieDb::replyFinished(QNetworkReply *reply)";
}
To copy to clipboard, switch view to plain text mode
I know that an undefined reference means that i still have to implement one function but i thought i implemented everything the interface specifies.
Hope you can help me
Regards,
Marcel
Bookmarks