Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: Vic , djgpp AT delorie DOT com Date: Fri, 6 Mar 1998 14:48:30 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: HELP: C++ virtual problems In-reply-to: <34FFB616.699E@cam.org> Precedence: bulk Vic 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