tags:

views:

44

answers:

1

I have a static member in my class. It's declared and defined:

In my header:

class Bla {
...
static Bla* instance;
...
};

In my implementation file:

Bla::Bla* instance = 0;

But ld doesn't seems to like it:

release/bla.o:bla.cpp:(.text+0x19f7): undefined reference to `Bla::instance'

I'm using GCC 4.4.0 from the Qt SDK.

I can't figure it out what I'm doing wrong. Can someone shed a light on this issue?

+5  A: 

You missed a Bla, and instead created a global. :) Make it:

Bla* Bla::instance = 0;

EDIT: I had a typo above. Should be right now.

John Dibling