I know this has been asked 10000 times, however, I'm still having issues getting this to compile. Notice the static member 'map'.
In the 'getMap()' function, I receive an undefined reference error referring to the map data member. I attempted to move that function to a cpp file and declare 'map' in that file. However, I then receive a conflicting definition error.
Can somebody explain to me what is going on? Thanks
Base.h
template<typename T> Base * createT() { return new T; }
typedef std::map<std::string, Base*(*)()> map_type;
class BaseFactory
{
    static Base* createInstance(std::string const& s)
    {
        map_type::iterator it = getMap()->find(s);
        if (it == getMap()->end())
            return 0;
        return it->second();
    }
protected:
    static map_type *getMap()
    {
        if (!map)
        {
            map = new map_type;
        }
        return map;
    }
private:
    static map_type * map;
     static Base* createInstance(std::string const* s);
public:
     BaseFactory();
     ~BaseFactory();
};
 
     
    