Mail Archives: djgpp/1998/03/06/12:51:59
Vic <tudor AT cam DOT org> wrote:
> I'm making this GUI in C++. I declared a base class, XbaseWidget that
> contains virtual functions like MouseUp, mouseDown etc.
> Each other class is derived from this one (like the buttons, dsktop etc)
> It all compiles without any warnings (I use -c -Wall -O ) but when I
> want to link it, I get "undefined reference to XbaseWidget virtual
> table". What is this? I don't have much experience in C++ and I really
> don't have any ideea what is going on.
> this is an example of the class declarations (full sources are available
> if this would help)
It happends when you don't created all the members that you declared. You must
specify code for ALL the members. Even if you create a pure-virtual base class
you must specify at least a dummy for the members or explicitly say that they
are initialized to 0 (virtual members are pointers to functions they must
point to somewhere).
That's the most common case, there are others.
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -