g++ looses an entire class.
Alexandre Oliva
oliva@dcc.unicamp.br
Sat Dec 5 20:48:00 GMT 1998
On Dec 4, 1998, Scott A Crosby <crosby@qwes.math.cmu.edu> wrote:
> /root/Documents/programming/classes/indep_study/model_trivial.cpp:48:
> undefined reference to `Simple::Simple(int)'
> /root/Documents/programming/classes/indep_study/model_trivial.cpp:49:
> undefined reference to `Simple::~Simple(void)'
> /root/Documents/programming/classes/indep_study/model_trivial.cpp:49:
> undefined reference to `Simple::~Simple(void)'
No definition was provided for the declared destructors of classes
Model and Simple. Therefore, according to the C++ Standard, your code
is invalid, because every non-abstract non-inline member-functions
must be given a definition in exactly one translation unit of a
program.
The constructor of Simple wasn't defined because of an optimization of
egcs (that is valid according to this restriction of the C++ Standard)
of only emitting out-of-line versions of inline functions in the
translation unit that defines the first non-abstract non-inline member
function of a class.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list