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

From: "Kevin M. Krom" <kevin DOT krom AT cs DOT cmu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Unknown link error
Date: Fri, 20 Jun 1997 18:09:52 -0400
Organization: Carnegie Mellon University
Lines: 38
Message-ID: <33AAFFB0.71D1@cs.cmu.edu>
Reply-To: kevin DOT krom AT cs DOT cmu DOT edu
NNTP-Posting-Host: u.gp.cs.cmu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm using gcc version 2.7.2.1

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

-- 
Kevin M. Krom                     kevin DOT krom AT cs DOT cmu DOT edu
Master of Software Engineering    http://www.cs.cmu.edu/~kmkrom/
Carnegie Mellon University        +1 (412) 268-8423

- Raw text -


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