未定义的参考`vtable for Tuner'?????? [英] undefined reference to `vtable for Tuner' ??????

查看:124
本文介绍了未定义的参考`vtable for Tuner'??????的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编译我当前的项目我收到以下错误:

[链接器错误]未定义引用`vtable for Tuner''

我知道的唯一两件事是当试图调用类的构造函数并且涉及虚函数时,会出现错误

这是什么意思?

Compiling my current project I received the following error:
[Linker error] undefined reference to `vtable for Tuner''
The only two things I know are that the error occours when trying to invoke
the constructor of a class and that concerns virtual functions.
What does it mean?

推荐答案



" alessandro" <公顷******* @ virgilio.it>在消息中写道

新闻:是的*********************** @ news3.tin.it ...

"alessandro" <ha*******@virgilio.it> wrote in message
news:Yp***********************@news3.tin.it...
编译我当前的项目我收到以下错误:
[链接器错误]未定义引用`vtable for Tuner''
我知道的唯一两件事是在尝试$时出现错误b $ b调用类的构造函数,它涉及虚函数。
它是什么意思?
Compiling my current project I received the following error:
[Linker error] undefined reference to `vtable for Tuner''
The only two things I know are that the error occours when trying to invoke the constructor of a class and that concerns virtual functions.
What does it mean?




调谐器或其基础是否有任何虚函数?你有没有提供

的定义?值得为这种

问题进行全面重建。


John



Does Tuner or its bases have any virtual functions? Have you provided
definitions for them? It''s worth trying a total rebuild for this sort of
problem.

John


那是Tuner的定义,它是基类:


类调谐器:模块

{

受保护:

SDL_Surface *显示; //主要类似lcd的显示器


public:


static const unsigned int type = MODULE_NONE; //保存代码

指定模块


调谐器(Sound * s,Graphic * g,Global * gl);

~调谐器();


虚拟void开始();

/ *每当输入事件必须是
时,都会调用以下方法
通知

到模块实例。* /


virtual void MouseUp(Point * p);

虚拟void MouseMove(Point * p)

{

mousepos.x = p-> x;

mousepos.y = p-> y;

}

};

类模块

{

protected:

bool跑步; //这个帖子正在运行

bool pause; //这个帖子暂停了


声音*声音; //全球声音数据

图形*图形; //全球图形数据

全球*全球; //全局变量


点鼠标; //鼠标的位置


SDL_Surface * icon;


public:


static const unsigned int type = MODULE_NONE; //保存代码

指定模块


模块(Sound * s,Graphic * g,Global * gl,char * iconname);


//〜模块()


虚拟void Begin();

SDL_Surface * GetIcon(){return icon ; }


/ *每当输入事件必须通过

通知模块实例的
时,就会调用以下方法。* /


virtual void MouseUp(Point * p){};

virtual void MouseMove(Point * p)

{

mousepos.x = p-> x;

mousepos.y = p-> y;

}

};
that''s the definition of Tuner and it''s base class:

class Tuner:Module
{
protected:
SDL_Surface* display; //Main lcd-like display

public:

static const unsigned int type = MODULE_NONE; //Holds a code that
specifies the module

Tuner(Sound* s, Graphic* g, Global* gl);
~Tuner();

virtual void Begin();
/*The following methods are called whenever an input event must be
notified
to the module instance.*/

virtual void MouseUp(Point* p);
virtual void MouseMove(Point* p)
{
mousepos.x = p->x;
mousepos.y = p->y;
}
};
class Module
{
protected:
bool running; //This thread is running
bool pause; //This thread is in pause

Sound* sound; //Global sound data
Graphic* graphic; //Global graphic data
Global* global; //Global variables

Point mousepos; //Position of the mouse

SDL_Surface* icon;

public:

static const unsigned int type = MODULE_NONE; //Holds a code that
specifies the module

Module(Sound* s, Graphic* g, Global* gl, char* iconname);

//~Module()

virtual void Begin();
SDL_Surface* GetIcon() { return icon; }

/*The following methods are called whenever an input event must be
notified
to the module instance.*/

virtual void MouseUp(Point* p) {};
virtual void MouseMove(Point* p)
{
mousepos.x = p->x;
mousepos.y = p->y;
}
};




" alessandro" <公顷******* @ virgilio.it>在消息中写道

新闻:II *********************** @ news3.tin.it ...

"alessandro" <ha*******@virgilio.it> wrote in message
news:II***********************@news3.tin.it...
这是Tuner的定义及其基类:

类调谐器:模块
{
受保护:
SDL_Surface *显示; //主要类似lcd的显示器

public:

static const unsigned int type = MODULE_NONE; //保存一个
指定模块的代码

调谐器(Sound * s,Graphic * g,Global * gl);
〜调谐器();

virtual void Begin();
/ *只要输入事件必须通知模块实例,就会调用以下方法。* /

virtual void MouseUp(Point * p);
virtual void MouseMove(Point * p)
{
mousepos.x = p-> x;
mousepos.y = p- > y;
}
};

类模块
{
受保护:
bool运行; //这个帖子正在运行
bool pause; //这个线程暂停

声音*声音; //全球声音数据
Graphic * graphic; //全球图形数据
全球*全球; //全局变量

点鼠标; //鼠标的位置

SDL_Surface *图标;

公共:

static const unsigned int type = MODULE_NONE; //保存一个代码,用于指定模块

模块(Sound * s,Graphic * g,Global * gl,char * iconname);

// 〜模块()

virtual void Begin();
SDL_Surface * GetIcon(){return icon; }

/ *每当输入事件必须通知模块实例时,都会调用以下方法。* /

virtual void MouseUp( Point * p){};
virtual void MouseMove(Point * p)
{/ p> mousepos.x = p-> x;
mousepos.y = p-> y;
}
};
that''s the definition of Tuner and it''s base class:

class Tuner:Module
{
protected:
SDL_Surface* display; //Main lcd-like display

public:

static const unsigned int type = MODULE_NONE; //Holds a code that
specifies the module

Tuner(Sound* s, Graphic* g, Global* gl);
~Tuner();

virtual void Begin();
/*The following methods are called whenever an input event must be
notified
to the module instance.*/

virtual void MouseUp(Point* p);
virtual void MouseMove(Point* p)
{
mousepos.x = p->x;
mousepos.y = p->y;
}
};
class Module
{
protected:
bool running; //This thread is running
bool pause; //This thread is in pause

Sound* sound; //Global sound data
Graphic* graphic; //Global graphic data
Global* global; //Global variables

Point mousepos; //Position of the mouse

SDL_Surface* icon;

public:

static const unsigned int type = MODULE_NONE; //Holds a code that
specifies the module

Module(Sound* s, Graphic* g, Global* gl, char* iconname);

//~Module()

virtual void Begin();
SDL_Surface* GetIcon() { return icon; }

/*The following methods are called whenever an input event must be
notified
to the module instance.*/

virtual void MouseUp(Point* p) {};
virtual void MouseMove(Point* p)
{
mousepos.x = p->x;
mousepos.y = p->y;
}
};




您是否为Tuner :: Begin(),Tuner :: MouseUp()和
Module :: Begin()?即使你不打电话,也必须始终定义每个非纯虚函数




john



Have you provided definitions for Tuner::Begin(), Tuner::MouseUp() and
Module::Begin() ? Every non-pure virtual function must always be defined
even if you don''t call it.

john


这篇关于未定义的参考`vtable for Tuner'??????的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆