delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/05/20:53:07

Date: Thu, 5 Oct 2000 20:52:08 -0400
Message-Id: <200010060052.UAA28536@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <8rj5kv$384$1@nnrp1.deja.com> (dcasale@my-deja.com)
Subject: Re: Does DJGPP support static class member variables?
References: <8rj5kv$384$1 AT nnrp1 DOT deja DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> What the subject says.  I just tried to link a program which contains a
> class with one of its member variables declared static.  The linker
> can't find the variable, or so it claims.

Declaring a static member variable is only a prototype.
You still have to create the variable, just like you
have to create all the member functions.  Do something
like this:

int Foo::var = 0;

(just like "int i = 0;")

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019