姬長信(Redy)

c – Qt链接器错误:“对vtable的未定义引…


参见英文答案 > Undefined reference to vtable. Trying to compile a Qt project????????????????????????????????????16个
这是我的标题:
#ifndef BARELYSOCKET_H
#define BARELYSOCKET_H

#include 
//! The First Draw of the BarelySocket!

class BarelySocket: public QObject
{
    Q_OBJECT

public:
    BarelySocket();
public slots:
    void sendMessage(Message aMessage);
signals:
    void reciveMessage(Message aMessage);

private:
    //   QVector reciveMessages;
};

#endif // BARELYSOCKET_H

这是我的班级:

#include 
#include 
#include "type.h"
#include "client.h"
#include "server.h"

#include "barelysocket.h"

BarelySocket::BarelySocket()
{
    //this->reciveMessages.clear();
    qDebug("BarelySocket::BarelySocket()");
}

void BarelySocket::sendMessage(Message aMessage)
{
}

void BarelySocket::reciveMessage(Message aMessage)
{
}

我收到链接器错误:

undefined reference to 'vtable for BarelySocket'

>这意味着我有一个未实现的虚方法.但那里
我班上没有虚拟方法.
>我评论出矢量认为它是原因,但是
错误没有消失.
> Message是一个复杂的结构,但即使使用int也可以
不解决问题.