Article View: gnu.g++.bug
Article #815Re: A severe bug with statics members.
From: Mike Stump
Date: Sat, 29 Aug 1992 13:37
Date: Sat, 29 Aug 1992 13:37
48 lines
1966 bytes
1966 bytes
The decclaration of a static member does not serve as its definition.
Please find a recent book on C++ for more details.
> Message-Id: <9208221844.AA21654@life.ai.mit.edu>
> Date: Sat, 22 Aug 92 14:34:04 COL
> From: Luis Armando Cobo <LCOBO%ANDESCOL.BITNET@mitvma.mit.edu>
> Organization: Universidad de Los Andes - Bogota, Colombia
> In a DECstation 5000/125 with ULTRIX 4.2, and gcc/g++ 2.2.2 and with
> this program:
> class ONE {
> protected:
> static int a_member;
> public:
> ONE(void) {a_member = 1;}
> set(int x) {a_member = x; }
> };
> ONE p;
> int main(void)
> {
> p.set(5);
> return 0;
> }
> I obtain:
> % g++ ONE.cc -o ONE
> ld:
> Undefined:
> _3ONE$a_member
> collect: /usr/bin/ld returned 1 exit status
> Any ideas?
> ///LuiX
> +----------------------------------------+
> | Luis Armando Cobo Campo |
> | Centro de Computacion |
> | Ingeniero |
> | Universidad de los Andes +------------------------------------------+
> | Santafe de Bogota D.C. | Fax: +57 1 281 56 80 |
> +--------------------------| Tel: +57 1 284 18 90 |
> | E-Mail: |
> | lcobo@andescol.uniandes.edu.co Internet|
> | LCobo@ANDESCOL.BITNET BITNET |
> +------------------------------------------+
Technical Details
Message-ID:
<9208291337.AA28866@cygnus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrsShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs From: mrs@cygnus.com (Mike Stump) Subject: Re: A severe bug with statics members. Message-ID: <9208291337.AA28866@cygnus.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sat, 29 Aug 1992 13:37:29 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 51