delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/24/15:33:43

Message-ID: <c=US%a=_%p=Hassler_Communic%l=DAISY-970624193210Z-323@daisy.hcst.com>
From: Bryan Murphy <bryan DOT murphy AT hcst DOT com>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>,
"'kevin DOT krom AT cs DOT cmu DOT edu'"
<kevin DOT krom AT cs DOT cmu DOT edu>
Subject: RE: Unknown link error
Date: Tue, 24 Jun 1997 15:32:10 -0400
MIME-Version: 1.0

Sounds like you have a function head in there somewhere, but
no code for it.  If you define a function and don't include code, 
you'll get that wonderfully descriptive "C virtual Table" error.  That
bug held my project up for an entire month because I thought the
problem was templates.  Make sure you actually have code, or
at least an empty set of {}'s for all your routines.

Bryan Murphy
Web Developer
HCST, Inc. : http://www.hcst.com/
Home Page: http://www.hcst.com/~bryan/

>Essentially what I have is a link error on an inheritance-based
>system.  I have class A which defines two abstract virtual functions,
>class B (which actually does nothing) inheriting from A, and class
>C inherits from B and implmenets the two virtual functions.
>
>When I compile (gcc -g -ansi -Wall -fhandle-exceptions -c *.cc)
>everything is fine.  When I link (gxx *.o -lfl -lm), I get the
>following error:
>
>	C.o: In function `C::C(char *)':
>	C.cc:91: undefined reference to `C virtual table'
>
>I've checked the header files -- textbook C++, quite simple
>actually.  The C.cc file has the following at line 91:
>
>	C::C(char* name) : B(name)
>	{
>	}
>
>Now, I do have both abstract functions redeclared (correct
>name, return types, and signatures), but only one of them
>implmemented in the .cc file -- the other one isn't being 
>called (if it were, the linker should show that anyway).
>
>I've never seen a link error like this before... any
>suggestions?  (I'd be willing to provide the actual source
>code and makefiles on request.)
>
>Thanks in advance,
>
>	Kevin
>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019