首页 > 解决方案 > 未定义对类的 vtable 的引用

问题描述

我的课程DvQkdLdpcTxMessageProcessorReceiver如下:

#ifndef DV_QKD_LDPC_TX_MESSAGE_PROCESSOR_RECEIVER_H_
#define DV_QKD_LDPC_TX_MESSAGE_PROCESSOR_RECEIVER_H_

#include "netxpto_20200819.h"
#include "dv_qkd_message_processor_common_20200819.h"

class DvQkdLdpcTxMessageProcessorReceiver : public Block 
{
public:
    DvQkdLdpcTxMessageProcessorReceiver(std::initializer_list<Signal*> InputSig, std::initializer_list<Signal*> OutputSig) : Block(InputSig, OutputSig) {};

    void initialize(void);

    bool runBlock(void);

private:
    
    // Input Parameters ##################################################################################

    // State Variables ###################################################################################

    std::vector<t_message> storedMessages{};
    
    // Basis Reconciliation
    t_integer messageReconciliationMaximumDataLength{ 4096 };
    CircularBuffer<t_binary> BasesFrom{ messageReconciliationMaximumDataLength };

    // Parameter Estimation
    t_integer messageParameterEstimationMaximumDataLength{ 100 };

    t_integer numberOfProcessedBits{ -1 };

    CircularBuffer<t_integer> SeedFrom{ 10 };
    CircularBuffer<t_integer> RatioFrom{ 10 };
    CircularBuffer<t_integer> NumberOfBitsPerEstimationBlockFrom{ 10 };
    CircularBuffer<t_binary> DataFrom{ 10*(size_t) messageParameterEstimationMaximumDataLength };

    // Error correction - Parities
    std::vector<t_integer> parityIn{};
    bool errCorrParitiesStarted{ false };

    // Sindrome
    t_integer messageSindromeMaximumDataLength{ 5000 };
    CircularBuffer<t_binary> Sindrome{ messageSindromeMaximumDataLength };

    // Error correction - Permutations
    std::vector<t_integer> permutationsIn{};
    bool errCorrPermStarted{ false };

    // Error correction - BER
    std::vector<t_integer> errCorrBerIn{};
    bool errCorrBerStarted{ false };

    // Privacy amplification seeds
    std::vector<t_integer> privacySeedsIn{};
    bool privacySeedsStarted{ false };

    bool outputReceivedData(std::vector <t_integer>& dataVector, Signal& outputSignal, bool &started);

};
#endif // !MESSAGE_PROCESSOR_RECEIVER_H_

父类定义为:

class Block {

public:

    /* Methods */
    Block(){};
    Block(std::vector<Signal*> &InputSig, std::vector<Signal*> &OutputSig);
    Block(std::initializer_list<Signal*> InputSig, std::initializer_list<Signal*> OutputSig); // since C++11


    //void initializeBlock(std::vector<Signal*> InputSig, vector<Signal*> OutputSig);
    void initializeBlock();

    virtual void initialize(void) {};
    //bool runBlock();
    virtual bool runBlock();

    void terminateBlock();
    virtual void terminate(void) {};

    void closeOutputSignals();

    void setNumberOfInputSignals(int nOfInputSignal) { numberOfInputSignals = nOfInputSignal; };
    int getNumberOfInputSignals() { return numberOfInputSignals; };

    void setNumberOfOutputSignals(int nOfOutputSignal) { numberOfOutputSignals = nOfOutputSignal; };
    int getNumberOfOutputSignals() { return numberOfOutputSignals; };

    void setLogValue(bool lValue) { logValue = lValue; }
    bool getLogValue() { return logValue; }

    void setFirstRun(bool fRun) { firstRun = fRun; }
    bool getFirstRun() { return firstRun; }

    void setFirstTime(bool fTime) { firstTime = fTime; }
    bool getFirstTime() { return firstTime; }

    void setTerminated(bool t) { terminated = t; }
    bool getTerminated() { return terminated; }

    std::string getSignalsFolderName();

    void setVerboseMode(t_bool vMode) { verboseMode = vMode; }
    t_bool getVerboseMode(void) { return verboseMode; }

    void setVerboseFolderName(t_string vFolderName) { verboseFolderName = vFolderName; }
    t_string getVerboseFolderName(void) const { return verboseFolderName; }

    std::vector<Signal *> inputSignals;
    std::vector<Signal *> outputSignals;

private:

    bool logValue{ true };
    bool firstRun{ true };      // To be deleted, 2020/02/04, the name firstTime is more comum
    bool firstTime{ true };
    bool terminated{ false };

    t_bool verboseMode{ true };

    int numberOfInputSignals{ 1 };  
    int numberOfOutputSignals{ 1 }; 

    t_string verboseFolderName{ "verbose" };

};

当我在终端中制作时,我收到以下错误:

undefined reference to `vtable for DvQkdLdpcTxMessageProcessorReceiver'

在此处输入图像描述

我该如何解决?我搜索了很多关于错误的信息(我试图找到纯虚方法或内联函数和......),但没有结果。谢谢你。

标签: c++ubuntuundefined-referencevtable

解决方案


推荐阅读