0

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?

0

1 Answer 1

8

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

Bla* Bla::instance = 0; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.