if I have a static member variable of a class A declared in the file Af.h and I want to use this variable inside a method "met" of this same class inside the file Af.cpp, how do I proceed? here is my files
Af.h
class A
{
public:
static std::vector <int> vec;
void met();
//....
};
Af.cpp
//...
void A::met()
{
// I will use here some int variable i
vec.push_back(i);
//...
}
Unfortunately,this code provides the following compiling error:
undefined reference to A::vec