Article View: gnu.g++.bug
Article #813Re: uninitialized static members
From: tiemann
Date: Mon, 17 Aug 1992 00:48
Date: Mon, 17 Aug 1992 00:48
42 lines
1665 bytes
1665 bytes
Return-Path: gnulists@ai.mit.edu
Date: Sun, 16 Aug 92 19:04:40 +0200
From: tmb@idiap.ch (Thomas M. Breuel)
Sender: gnulists@ai.mit.edu
To: bug-g++@prep.ai.mit.edu
Subject: uninitialized static members
Reply-To: tmb@idiap.ch
I'm having a problem with uninitialized static class members in GCC
C++ 2.2.2.
Basically, if I only define the static class member inside the class
(without explicitly initializing it), I get a link-time undefined
symbol error.
I was under the impression that I didn't have to provide any
definition (in addition to what is present in the header) for
uninitialized static class members.
Thomas.
PS: A little more concretely:
struct NISTDigitImages {
static int *table;
...
};
...
gcc -L/homes/tmb/src/nvis/lib rec-gh.o loadihdr.o ihead.o g4decomp.o winlib.o -lX11 -lvis -lm -o rec-gh
ld: Undefined symbol
__15NISTDigitImages$table
collect: /usr/bin/ld returned 2 exit status
make: *** [rec-gh] Error 1
We have changed the behavior of G++ to match the ANSI spec. The
behavior you are now seeing is "correct". I'm sorry that it's less
convenient.
Michael
Technical Details
Message-ID:
<9208171448.AA13619@rtl.cygnus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!tiemannReferences:
<9208161704.AA07645@idiap.ch>Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!tiemann From: tiemann@cygnus.com Subject: Re: uninitialized static members Message-ID: <9208171448.AA13619@rtl.cygnus.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet References: <9208161704.AA07645@idiap.ch> Distribution: gnu Date: Mon, 17 Aug 1992 00:48:11 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 43