Re: [Dev-C++] Accessing static data from non-static function
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Josh M. <mrl...@gm...> - 2006-01-17 21:27:22
|
If I recall correctly, static class members must be in this form:
class foo
{
public:
int staticbar;
};
static int foo::staticbar;
On 1/17/06, Klaas Mussche <kla...@gm...> wrote:
>
> Hey, I am trying to make a class with some static pointers to allegro
> bitmaps. But now i cannot access the static data on the normal way. I
> declared the data so: static BITMAP* bmp; and tried to access it from
> other, non-static member functions from the same class by using simply bm=
p,
> but that don't work. Using Classname::bmp also don't work, not in the
> other non-static member functions from the same class, and not from other
> functions, such as main(). I have included the header file. I always get =
the
> same error's: [Linker error] undefined reference to ` Classname::bmp'
> for every time I tried to access the static date.
>
> I have also tried to make a static int but that also don't work. Could
> anyone tell me what i'm doing wrong?
>
--
Cheers,
Josh
PGP: http://revvy.box43.net/Josh_Matthews.asc
|