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? 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
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 " <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
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).
"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
"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
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
"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
"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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
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:
-----------------------
|
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*)':
|
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'
|
by: jimjim |
last post by:
Hello all,
class Base {
public:
virtual void f(); };
class Derived : public Base{
private:
int i; };
| |
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;
|
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*)
|
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...
|
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()':
|
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...
|
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...
| |
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,...
|
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...
|
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();...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |