This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: MIPS C++ bug
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: <gp at qnx dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: 17 Jun 2003 21:51:19 -0300
- Subject: Re: MIPS C++ bug
- Organization: GCC Team, Red Hat
- References: <200306172033.h5HKXbM29274@webmail.qnx.com>
On Jun 17, 2003, <gp@qnx.com> wrote:
> ./libsomelib.so: undefined reference to `SomeCls::DEF_INST'
I'm afraid your program is in error. Even though SomeCls::DEF_INST is
a public static const int, initialized in place, a global definition
of every static data member is still mandatory. In case the
initializer in the declaration is given, the definition must not have
an initializer. I.e., add to one of your translation units the
following line:
const int SomeCls::DEF_INST;
and your program will be well-formed C++ per the current C++ Standard,
and, as a bonus, will likely link correctly too :-)
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer