Following is the code that works fine
class HttpService {
public:
virtual ~HttpService(); // implemented in .cpp
protected:
HttpService(struct MHD_Connection *conn) {}
};
class HttpFileService : public HttpService
{
public:
virtual ~HttpFileService() ; // implemented in .cpp
protected:
HttpFileService(struct MHD_Connection *conn) : HttpService(conn) {}
};
Now, when I make HttpService
a derived class of QObject
, like below:
#include <QObject> // change #1
class HttpService : public QObject { // change #2
Q_OBJECT // change #3
public:
virtual ~HttpService();
protected:
HttpService(struct MHD_Connection *conn) {}
};
class HttpFileService : public HttpService {
Q_OBJECT // change #4
public:
virtual ~HttpFileService() ;
protected:
HttpFileService(struct MHD_Connection *conn) : HttpService(conn) {}
};
I encounter the following linking error:
Undefined symbols for architecture x86_64:
"vtable for HttpService", referenced from:
HttpService::~HttpService()in httpservice.o
Changing HttpService
's constructor to the following doesn't help either
explicit HttpService(QObject *parent = 0) : QObject(parent)
Force running qmake and see if it works.
Are you linking to the correct qt libraries?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With