Ниже приведен код, который отлично работает
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) {}
};
Теперь, когда я делаю HttpService
производным классом QObject
, как показано ниже:
#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) {}
};
я сталкиваюсьследующая ошибка компоновки:
Undefined symbols for architecture x86_64:
"vtable for HttpService", referenced from:
HttpService::~HttpService()in httpservice.o
Изменение конструктора HttpService
на следующее также не помогает
explicit HttpService(QObject *parent = 0) : QObject(parent)