相关疑难解决方法(0)

未定义的vtable参考

所以,我变得臭名昭着

未定义的引用'vtable ...

以下代码的错误(有问题的类是CGameModule.)我不能为我的生活理解问题所在.起初,我认为这与忘记给虚拟功能一个身体有关,但据我所知,一切都在这里.继承链有点长,但这里是相关的源代码.我不确定我应该提供哪些其他信息.

注意:构造函数是发生此错误的地方,看起来如此.

我的代码:

class CGameModule : public CDasherModule {
 public:
  CGameModule(Dasher::CEventHandler *pEventHandler, CSettingsStore *pSettingsStore, CDasherInterfaceBase *pInterface, ModuleID_t iID, const char *szName)
  : CDasherModule(pEventHandler, pSettingsStore, iID, 0, szName)
  { 
      g_pLogger->Log("Inside game module constructor");   
      m_pInterface = pInterface; 
  }

  virtual ~CGameModule() {};

  std::string GetTypedTarget();

  std::string GetUntypedTarget();

  bool DecorateView(CDasherView *pView) {
      //g_pLogger->Log("Decorating the view");
      return false;
  }

  void SetDasherModel(CDasherModel *pModel) { m_pModel = pModel; }


  virtual void HandleEvent(Dasher::CEvent *pEvent); 

 private:



  CDasherNode *pLastTypedNode;


  CDasherNode *pNextTargetNode;


  std::string m_sTargetString;


  size_t m_stCurrentStringPos;


  CDasherModel *m_pModel;


  CDasherInterfaceBase …
Run Code Online (Sandbox Code Playgroud)

c++ gcc g++

315
推荐指数
18
解决办法
47万
查看次数

对 vtable 的未定义引用... Q_OBJECT 宏

当我取消对信号槽所需的 Q_OBJECT 宏的注释时,我得到了一个对 vtable 的未定义引用,用于 MyApp 错误,但没有宏它可以完美编译,但没有它我无法使用信号和槽。我想我可能做错了一些愚蠢的事情,但请尝试提供帮助,因为我真的找不到问题所在。哦,我知道我的代码不整洁,正在处理它。

我的应用程序.h:

#ifndef MYAPP_H
#define MYAPP_H

#include <QApplication>
#include <QEvent>
#include <QObject>
#include <QDebug>

class MyApp : public QApplication
{

public:
    MyApp( int argc, char** argv );

protected:
    bool eventFilter(QObject *object, QEvent *event);

signals:
    void focusG();
    void focusL();
};

#endif // MYAPP_H
Run Code Online (Sandbox Code Playgroud)

myapp.cpp:

#include "myapp.h"

MyApp::MyApp(int argc, char **argv): QApplication(argc, argv)
{
    installEventFilter(this);
}

bool MyApp::eventFilter(QObject *object, QEvent *event)
{
    if (event->type() == QEvent::ApplicationDeactivate)
    {
        qDebug() << "Focus lost";
        //focusL();
    }
    if (event->type() == …
Run Code Online (Sandbox Code Playgroud)

c++ macros qt undefined vtable

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×2

g++ ×1

gcc ×1

macros ×1

qt ×1

undefined ×1

vtable ×1