c++ - Using a static std::map<int,MyClass*> inside MyClass causes unresolve external symbol -


this question has answer here:

i want keep track of instance of myclass, have add private static variable std::map<int,myclass*> inside myclass. problem causes unresolved external symbol, don't know how debug. how can resolve this?

note: i'm seasoned java programmer , novice c++ programmer, , i'll using jni dll, why need keep track instances of myclass.

you haven't provided implementation:

myclass.h:

class myclass { private:     static std::map<int, myclass *> m_instances; ... }; 

myclass.cpp:

#include "myclass.h"  // add std::map<int, myclass *> myclass::m_instances; 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -