This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Suggested FAQ entry
- To: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Subject: Re: Suggested FAQ entry
- From: Doug Semler <doug at seaspace dot com>
- Date: Sun, 11 Apr 1999 17:35:20 -0700
- cc: Gabriel dot Dos-Reis at cmla dot ens-cachan dot fr, egcs at egcs dot cygnus dot com
- cc: egcs-patches at egcs dot cygnus dot com
> > Why? This is an implementation issue, not a language issue...isn't it?
>
> The fact that you MUST implement all virtual functions is a language
> requirement. [basic.def.odr] says
>
> >> A virtual member function is used if it is not pure. ... Every
> >> program shall contain exactly one definition of every noninline
> >> function or object that is used in that program; no diagnostic
> >> required.
>
> The fact that violation of this requirement results in the diagnostic
> 'virtual table undefined' is an implementation issue.
Mea culpa. And the diagnostic *is* emitted, in the linker, so it's
a little confusing...and, I admit, I read the docs for egcs and
the faq, but skipped the standard :)
>
> This *is* a FAQ, though, so having a FAQ entry might be a good
> idea. I'm not the FAQ maintainer, but if you provide a patch against
> http://egcs.cygnus.com/faq.html explaining the problem and the
> solution, I'm sure it will be accepted.
>
> Regards,
> Martin
This is a patch against faq.html, I put it as the last entry in the
miscellaneous section, seemed to be only place it fits....and it may need
a little editing...I'm not that good with words :)
---
Doug Semler | doug@seaspace.com
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)
-----BEGIN GEEK CODE BLOCK-----
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+>+++++**
------END GEEK CODE BLOCK------
*** faq.html.orig Sun Apr 11 17:20:22 1999
--- faq.html Sun Apr 11 17:29:14 1999
***************
*** 98,103 ****
--- 98,104 ----
(<tt>-fsquangle</tt>)</a>
<li><a href="#gperf">When building from CVS sources, I see 'gperf: invalid option -- F',
even with the most current version of gperf.</a>
+ <li><a href="#vtables">When building C++, the linker says my constructors, destructors or virtual tables are undefined, but I defined them</a>
</ol>
</ol>
***************
*** 1166,1171 ****
--- 1167,1182 ----
<hr>
+ <h2><a name="vtables">When building C++, the linker says my constructors, destructors or virtual tables are undefined, but I defined them</a></h2>
+
+ <p>The C++ language specifies that all virtual methods that are declared must
+ be defined. The linker error message is telling you that at least one
+ of the virtual methods declared has not been defined, as the constructors,
+ destructor, and virtual table was never emitted by egcs for the class.
+
+ <p>The solution is to ensure all virtual methods are defined.
+
+ <hr>
<p><a href="index.html">Return to the EGCS home page</a>
<p><i>Last modified: March 29, 1999</i>