473,670 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3009

"alessandro " <ha*******@virg ilio.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*******@virg ilio.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*******@virg ilio.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*******@virg ilio.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::func name() ?

Regards,
Slava
Jul 22 '05 #7
They are in form classname::func name(). 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*******@virg ilio.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*****@hotmai l.com> wrote in message
news:f5******** *************@b gtnsc04-news.ops.worldn et.att.net...

"alessandro " <ha*******@virg ilio.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
8470
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
2517
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 the link errors decreased from over 200 to 5. A great step! But one of my class derived from wxValidator can't be linked correctly though there is no any inline function in it. The error message: -----------------------
3
3448
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 function `TOpenAreaForm::TOpenAreaForm(TControl*)':
7
1090
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 MessageQueue.cpp MessageFragmenter.cpp SingleMessage.cpp /tmp/ccsrT4jU.o(.gnu.linkonce.t._ZN9c_ServiceD1Ev+0xb): In function `c_Service::~c_Service ()': : undefined reference to `vtable for c_Service'
9
9656
by: jimjim | last post by:
Hello all, class Base { public: virtual void f(); }; class Derived : public Base{ private: int i; };
4
5867
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
2813
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 pointers. Iam getting errors like 1. In function TOP::TOP(int) : undefined reference to CHILD1::CHILD1(int, float). 2. In function TOP::TOP(int) : undefined reference to vtt for CHILD2::CHILD2(char*)
5
11348
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 to pass all the necessary object files to the linker. Neither of those are my problem. Please bear with me as the question I ask is rather long and I think it's beyond a CS101 level of linker stupidity. If it is a stupid CS101 mistake I'm making...
2
2162
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' foo_test.o(.gnu.linkonce.t._ZN7CFooC1Ev+0x19): In function `CFoo::CFoo()': : undefined reference to `CFoo::rmap' foo_test.o(.gnu.linkonce.t._ZN7CFooC1Ev+0x30): In function `CFoo::CFoo()':
0
8901
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8813
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8591
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7412
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1791
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.