EGCS-1.1.2: static class member not linking.
Brendan Simon
brendan@dgs.monash.edu.au
Wed Jun 30 15:43:00 GMT 1999
Don't worry about my previous mail. I am embarrassed to say that I made a
simple error. I forgot to initialise the static member in the .cc source
file. I have done this a few times in my class so I don't know why I
missed it this time; maybe I should get more sleep.
Thanks,
Brendan (blushing) Simon.
Brendan Simon wrote:
> egcs version 1.1.2.
> RedHat 5.2 GNU/Linux operating system
>
> I have a class with some data members being declared static. Some of
> the members link properly and some do not. I have the same problem with
> egcs-1.1.2 using cygwin. This sample program (invoked with g++ -Wall -o
> static.cc shows the problem.
>
> // FILE : static.cc
>
> class FOO
> {
> public :
> void f1();
> int a;
> static int b;
> };
>
> void FOO::f1()
> {
> a += b;
> }
>
> int main()
> {
> FOO foo;
> foo.f1();
> return 0;
> }
>
> // END : static.cc
More information about the Gcc
mailing list