Suggested FAQ entry

Doug Semler
Sat Apr 10 19:29:00 GMT 1999

This should probably be a FAQ entry, we wasted eight man hours tracking 
this problem down, and AFAICT it isn't anywhere to be found in the docs or
the FAQ, if I missed it, please tell me :)...

  C++ classes exist which declare virtual functions in the header files,
  and define them in source modules.  Link errors occur when linking
  stating that constructors and virtual tables are undefined.

  The first virtual function declaration in the class is never defined in 
  any of our source modules (due to interface changes, etc). 
  It was previously defined, but no longer.  Therefore, the virtual 
  table/ctor/dtor definitions are never emitted.

  Make sure there exists a definition for all virtual functions
  declared in the header file - especially the first one declared (and not
  defined in the class declaration) - even if the functions are never used.

Doug Semler                       |
SeaSpace Corporation              | Garbage In -- Gospel Out
Least Senior Software Developer;  | Minister of things to do Next Quarter
Low Man on the Totem Pole         | (but will Never Be Done) DNRC  O-
A closed mind is a terrible thing | Bus Error (passengers dumped)
Version: 3.12
GCS/M d---(pu) s++:- a-- C++ UILSH+++$ P--- L++ E--- W+
N++ o-- K? w--(++$) O- M-- V- PS+ !PE Y PGP t(+) 5+++ X+
R- tv+(-) b+(++) DI++++ D G e++>++++ h!>--- r% y+>+++++**

More information about the Gcc-bugs mailing list