I have a class named CallMe that have a static method accessing a static variable...
// callme.h
class CallMe{
static std::map<std::string,int> myMap;
public:
// ... Other functions for adding removing etc...
static int Get(std::string name)
{
int value = 0;
// finding value ...
return value;
}
};
// callme.cpp
std::map<std::string,int> CallMe::myMap
And i am using CallMe class from other class that resides in a header file user.h
// user.h
#include "callme.h"
class User{
public:
int Call(std::string name)
{
return CallMe::Get(name);
}
};
All the code are in header files(except CallMe::myMap declaration) When I compile app. I get "undefined CallMe".
is this error happening because I defined the classes in the header files or cause of using static variable...