473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

undefined reference to `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?
Jul 22 '05 #1
9 2986

"alessandro" <ha*******@virgilio.it> wrote in message
news:Yp***********************@news3.tin.it...
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?


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
Jul 22 '05 #2
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;
}
};
Jul 22 '05 #3

"alessandro" <ha*******@virgilio.it> wrote in message
news:II***********************@news3.tin.it...
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;
}
};


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
Jul 22 '05 #4
Yes...provided a definition for every non-pure virtual function. Them are
simply
funcname()
{
}

but that should be enaught. However these errors occour again. Note that
these are linker errors, all in the Tuner.o file (that is, the error occours
in the derived class).
Jul 22 '05 #5

"alessandro" <ha*******@virgilio.it> wrote in message
news:Hf***********************@news3.tin.it...
Yes...provided a definition for every non-pure virtual function. Them are
simply
funcname()
{
}

but that should be enaught. However these errors occour again. Note that
these are linker errors, all in the Tuner.o file (that is, the error occours in the derived class).


Well I'm not sure then. Plenty of people have had this error before

http://groups.google.co.uk/groups?ie...ined+reference

Commonest reason seems to be failing to define a virtual function, but have
a look for yourself.

john
Jul 22 '05 #6
"alessandro" <ha*******@virgilio.it> wrote in message
news:Hf***********************@news3.tin.it...
Yes...provided a definition for every non-pure virtual function. Them are
simply
funcname()
{
}

but that should be enaught. However these errors occour again. Note that
these are linker errors, all in the Tuner.o file (that is, the error occours in the derived class).

Are they in form funcname() or classname::funcname() ?

Regards,
Slava
Jul 22 '05 #7
They are in form classname::funcname(). Now I'll install the latest mingw:
throught google I discovered that this is a pretty common error (but nobody
seems to be able to provide a solution or a workaround). Someone tells that
this error is given by a recent versione of gcc but not from the previous
ones, so I hope that using the newer available will fix the problem. Thank
yopu for the help

Jul 22 '05 #8

"alessandro" <ha*******@virgilio.it> wrote in message
news:II***********************@news3.tin.it...
that's the definition of Tuner and it's base class:

class Tuner:Module
Is this legal? I thought you had to specifiy the inheritance model also
(e.g., ": public Module)?

Also, is there a forward declaration of Module, or is this order you've
shown just for the purposes of posting here? As shown here, Tuner doesn't
yet know what Module is!
{
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;
}
};


Most likely you haven't defined a function that is declared somewhere. How
about the destructor for Tuner...is it defined anywhere? I see you've
commented out the destructor declaration for Module. Did you mean to also
comment out Tuner's destructor declaration?

(By the way, if you're ever going to use a Module* pointer to instantiate a
Tuner object, then you should make the Module destructor virtual.)

-Howard
Jul 22 '05 #9

"Howard" <al*****@hotmail.com> wrote in message
news:f5*********************@bgtnsc04-news.ops.worldnet.att.net...

"alessandro" <ha*******@virgilio.it> wrote in message
news:II***********************@news3.tin.it...
that's the definition of Tuner and it's base class:

class Tuner:Module


Is this legal? I thought you had to specify the inheritance model also
(e.g., ": public Module)?

It's legal. Default is private inheritance for classes and public
inheritance for structs.

john
Jul 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daniel Heiserer | last post by:
Hi, I got the following compiling/linking error, but I have no clue what it is about. Can anybody help me? thanks, daniel
2
by: Quansheng Liang | last post by:
Hello, I struggled with the problem of "undefined reference to `vtable ...`" while migrating a project from windows to linux. After searching the google I removed all the inline functions and now...
3
by: bp | last post by:
Hi, Could someone to tell me what I'm doing wrong? I'm using gcc version 3.3.4 and ld version 2.15.90.0.3 20040415 the linker message is: .../obj/classOpenAreaForm.o(.text+0x211): In...
7
by: Karl Ebener | last post by:
Hi! I have created a program using several classes with inheritage. When I compile and link, I get the following error: :$ g++ service2.cpp Service.cpp Application.cpp Message.cpp...
9
by: jimjim | last post by:
Hello all, class Base { public: virtual void f(); }; class Derived : public Base{ private: int i; };
4
by: Mark | last post by:
Hi, I'm trying to write some classes that kind of manage themselves. A linked list, that links different types of objects. Here's the code... object.h: --- class Object { int alt;
5
by: pavan734 | last post by:
Hi, Iam facing problem with undefined reference linking errors. To explain in more detail.. I have a class called TOP. In its constructor I have instantiated many other class objects using...
5
by: druberego | last post by:
I read google and tried to find the solution myself. YES I do know that you can get undefined references if you: a) forget to implement the code for a prototype/header file item, or b) you forget...
2
by: boyphp | last post by:
I'm getting the following undefined reference errors: foo_test.o(.gnu.linkonce.t._ZN7CFooD1Ev+0x18): In function `CFoo::~CFoo()': : undefined reference to `vtable for CFoo'...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.