🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #217

Re: simpler example of previous g++ bug report - unresolved static member

#217
From: Gnanasekaran Swaminathan
Date: Wed, 29 Jul 1992 22:45
28 lines
1132 bytes
eric@cathaus.utcs.utoronto.ca (Eric M. Carroll) wonders why he his getting
undefined symbol errors for static member variables in his
programs.

You need a definition for your static variables somewhere in your
program. The static variables must be defined in the file scope and
only once in your program.

|class A {
| public:
|    void test() ;
|
| private:
|    static int value ;
|} ;
|
|void A::test() {
|    value = 0 ;
|}

int A::value = 10; // definition for the static variable A::value

|main() {
|
|    return 0 ;
|}

-Sekar
Technical Details
Message-ID: <1992Jul29.224514.4893@murdoch.acc.Virginia.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!virginia.edu!gs4t
References: <9207291707.AA04988@cathaus.utcs.utoronto.ca>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!virginia.edu!gs4t
From: gs4t@virginia.edu (Gnanasekaran  Swaminathan)
Subject: Re: simpler example of previous g++ bug report - unresolved static member
Message-ID: <1992Jul29.224514.4893@murdoch.acc.Virginia.EDU>
Sender: gnulists@ai.mit.edu
Reply-To: gs4t@virginia.edu (Gnanasekaran  Swaminathan)
Organization: University of Virginia
References: <9207291707.AA04988@cathaus.utcs.utoronto.ca>
Distribution: gnu
Date: Wed, 29 Jul 1992 22:45:14 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 29