By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,433 Members | 1,702 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,433 IT Pros & Developers. It's quick & easy.

undefined reference to `vtable for ...

P: n/a
bp
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[not-in-charge](TControl*)':
.../src/appforms/classOpenAreaForm.cpp:66: undefined reference to `vtable
for TOpenAreaForm' ../obj/classOpenAreaForm.o(.text+0x367): In function
`TOpenAreaForm::TOpenAreaForm[in-charge](TControl*)':

.../appforms/classOpenAreaForm.cpp:66: undefined reference to `vtable for
TOpenAreaForm' ../obj/classOpenAreaForm.o(.text+0x4ce): In function
`TOpenAreaForm::TOpenAreaForm[not-in-charge](TControl*, int, int, int,
int, char const*)':

.../src/appforms/classOpenAreaForm.cpp:86: undefined reference to `vtable
for TOpenAreaForm' ../obj/classOpenAreaForm.o(.text+0x638): In function
`TOpenAreaForm::TOpenAreaForm[in-charge](TControl*, int, int, int, int,
char const*)':

.../src/appforms/classOpenAreaForm.cpp:86: undefined reference to `vtable
for TOpenAreaForm' collect2: ld returned 1 exit status

the headers of the involved classes:

TControl.h
______________
#ifndef __CONTROL_HPP_
#define __CONTROL_HPP_

class TControl
{
protected:
TControl *parent;
.....
public:
TControl(TControl *parent_);
TControl(TControl *parent_, int left_,int top_,
int width_,int height_,const char* caption_='\0');
virtual ~TControl(void);
....
};
#endif
--------------------

TForm.h
_________________
#include "classControl.hpp"

class TForm : public TControl {
protected:
virtual void Draw(void);
public:
TForm(TControl *parent_);
TForm(TControl *parent_, int left_, int top_, int width_,
int height_, const char* caption_);
.......
};
....
#endif

--------------------
TOpenAreaForm.h
_________________
#ifndef __OPENAREAFORM_HPP_
#define __OPENAREAFORM_HPP_
#include "../appgui/classForm.hpp"
// forward declaration
class TListView;

class TOpenAreaForm : public TForm {
public:
TOpenAreaForm(TControl *parent_);
TOpenAreaForm(TControl *parent_, int left_, int top_,
int width_, int height_, const char* caption_);
~TOpenAreaForm(void);
TListView* filelist;
void RefreshListItems(void);
};
....
#endif

------------

Thanks
Jul 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"bp" <bp@bp.aa> wrote in message
news:pa****************************@bp.aa...
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[not-in-charge](TControl*)':
../src/appforms/classOpenAreaForm.cpp:66: undefined reference to `vtable
for TOpenAreaForm' ../obj/classOpenAreaForm.o(.text+0x367): In function
`TOpenAreaForm::TOpenAreaForm[in-charge](TControl*)':

I don't know if this will help you, but I got this one time when I declared
a virtual member but failed to define it.

Jul 22 '05 #2

P: n/a
bp
On Fri, 20 Aug 2004 15:49:38 -0400, Xenos wrote:
I don't know if this will help you, but I got this one time when I declared
a virtual member but failed to define it.


It helped.
Thank you
Jul 22 '05 #3

P: n/a
bp wrote:
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[not-in-charge](TControl*)':
../src/appforms/classOpenAreaForm.cpp:66: undefined reference to
`vtable for TOpenAreaForm' ../obj/classOpenAreaForm.o(.text+0x367): In
function `TOpenAreaForm::TOpenAreaForm[in-charge](TControl*)':

../appforms/classOpenAreaForm.cpp:66: undefined reference to `vtable
for TOpenAreaForm' ../obj/classOpenAreaForm.o(.text+0x4ce): In
function `TOpenAreaForm::TOpenAreaForm[not-in-charge](TControl*, int,
int, int, int, char const*)':

../src/appforms/classOpenAreaForm.cpp:86: undefined reference to
`vtable for TOpenAreaForm' ../obj/classOpenAreaForm.o(.text+0x638): In
function `TOpenAreaForm::TOpenAreaForm[in-charge](TControl*, int, int,
int, int, char const*)':

../src/appforms/classOpenAreaForm.cpp:86: undefined reference to
`vtable for TOpenAreaForm' collect2: ld returned 1 exit status

the headers of the involved classes:

TControl.h
______________
#ifndef __CONTROL_HPP_
#define __CONTROL_HPP_
Identifiers containing two consecutive underscores are reserved for the
implementation (i.e. the compiler and its standard library). You are
not allowed to define any of those yourself.
class TControl
{
protected:
TControl *parent;
....
public:
TControl(TControl *parent_);
TControl(TControl *parent_, int left_,int top_,
int width_,int height_,const char* caption_='\0');
That might not do what you expect it to. '\0' is usually used as a
string termination character - a character with the value 0. But your
char* will not be assigned the address of such a 0 character. Rather it
will become a null pointer, since '\0' would just be an integer with
the value zero, which is in a pointer context interepreted a null
pointer constant, and _not_ a character constant. What you might have
wanted is:

TControl(TControl *parent_, int left_,int top_,
int width_,int height_,const char* caption_="");

virtual ~TControl(void);
....
};
#endif
--------------------

TForm.h
_________________
#include "classControl.hpp"

class TForm : public TControl {
protected:
virtual void Draw(void);
Is that Draw() member function actually defined anywhere?
public:
TForm(TControl *parent_);
TForm(TControl *parent_, int left_, int top_, int width_,
int height_, const char* caption_);
......
};
...
#endif

--------------------
TOpenAreaForm.h
_________________
#ifndef __OPENAREAFORM_HPP_
#define __OPENAREAFORM_HPP_
#include "../appgui/classForm.hpp"
// forward declaration
class TListView;

class TOpenAreaForm : public TForm {
public:
TOpenAreaForm(TControl *parent_);
TOpenAreaForm(TControl *parent_, int left_, int top_,
int width_, int height_, const char* caption_);
~TOpenAreaForm(void);
TListView* filelist;
void RefreshListItems(void);
};
...
#endif

------------

Thanks


--
This project is so important, we can't let things that are more
important interfere with it.
(Advertising/Marketing manager, United Parcel Service)

Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.