Article View: gnu.gcc.help
Article #529Re: (none)
From: Fergus James HENDERSON
Date: Thu, 01 Oct 1992 13:32
Date: Thu, 01 Oct 1992 13:32
28 lines
1252 bytes
1252 bytes
ydavid@dxcern.cern.ch (Yann David) writes:
>I am currently in the process of learning C++ and I have some difficulty
>using static class variables (when compiling my .C files with gcc).
>It seems that the linker does not recognize those static variables.
>
> #include <stream.h>
****> Use <iostream.h>; <stream.h> is only for backwards compatability.
> class MyClass
> { static int a=0;
****> Change this to
static int a; // no initialization
> public:
> void incA();
> };
****> and add the following:
int MyClass::a = 0; // initialization goes here
--
Fergus Henderson fjh@munta.cs.mu.OZ.AU
This .signature virus is a self-referential statement that is true - but
you will only be able to consistently believe it if you copy it to your own
.signature file!
Technical Details
Message-ID:
<9227523.1790@mulga.cs.mu.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjhReferences:
<9210010925.AA09167@dxcern.cern.ch>Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) Subject: Re: (none) Message-ID: <9227523.1790@mulga.cs.mu.OZ.AU> Sender: news@cs.mu.OZ.AU Organization: Computer Science, University of Melbourne, Australia References: <9210010925.AA09167@dxcern.cern.ch> Distribution: gnu Date: Thu, 1 Oct 1992 13:32:06 GMT Lines: 28