I'm writing a factory class where I need to keep track of how many of each kind of object I've made so far, so I through I'd use a static map to keep track of the numbers like this:According to what I can remember about static members and the result of a quick search, I think that this is the right way to declare this variable. However, when I compile (using g++ 4.0.2) I get a duplicate symbol error:Code:class Object { public: static std::map<String,int> typeCount; }; std::map<String,int> typeCount;It isn't including the file twice and all I'm doing in main is instantiating the class. Does anybody know why this is happening?obj/main.o(.bss+0x0): multiple definition of `Object::typeCount'
obj/object.o(.bss+0x0): first defined here