Mail Archives: djgpp/1997/04/07/17:39:04
tettb AT vitro DOT com wrote:
> Has anybody used virtual functions in djgpp.
Yes, I use them routinely.
> I have a base class
> declared with virtual functions. I derive a calss from this base class
> in which I overide the virtual functions. When I try to link however,
> any reference to these methods in the code file for the derived class
> shoot out an error that looks like this:
>
> code.o:code.cc:undefined reference to "the virtual function as it
> appears in the base class declaration"
I'm not sure if I've seen this particular error with gcc before, but it
sounds like you're not declaring the virtual function in the derived class
with the same prototype (although in that case it should be a warning that
you're masking a virtual member function). That is, if you want to have
virtual member function, they must all take _exactly_ the same parameters
and have _exactly_ the same return type as the original virtual member
function. Otherwise you won't get the effect you're looking for.
If this isn't your problem, post the smallest amount of code that
reproduces it.
--
Erik Max Francis, &tSftDotIotE / email: max AT alcyone DOT com
Alcyone Systems / web: http://www.alcyone.com/max/
San Jose, California, United States / icbm: 37 20 07 N 121 53 38 W
\
"E pur, / sic muove!"
/ Galileo Galilei
- Raw text -