M
Magcialking
I'm writting a code using singleton idea much like this one:
//I have it simplified as to be brief
class a{
public:
static a&get(){return obj;}
void fun(){}
private:
static a obj;
}
int main(){
a::get().fun();
}
the problem occurs during the linking process I guess, because the
message returned as follow
"main.cpp:: undefined reference to `filelist::_obj' "
without line number
I don't know what's going wrong here
Could anybody help me?
//I have it simplified as to be brief
class a{
public:
static a&get(){return obj;}
void fun(){}
private:
static a obj;
}
int main(){
a::get().fun();
}
the problem occurs during the linking process I guess, because the
message returned as follow
"main.cpp:: undefined reference to `filelist::_obj' "
without line number
I don't know what's going wrong here
Could anybody help me?