Why is [the linker | the library loader at runtime] complaining about an undefined symbol which I declared as static member of one of my classes?
You forgot to instanciate the static member. Whenever you declare a static member in one of your classes, then this declaration servers as a "place holder" telling the compiler/linker that this object will be defined elsewhere. Normally you will declare the static member in the include file and define it, i.e. allocate memory for it, in a Example:Header with declaration (foo.h):class Foo { private: static boolean active; }; Implementation with definition (foo.cpp):#include <foo.h> boolean Foo::active(false); There is a way to tell which symbols are undefined:
-- ThomasJuerges - 30 Nov 2006 |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|