I have a class with a static char array.
The size of the array is given to me in argv
.
I want to do somthing like this:
class ABC {
public:
static char *buffer;
ABC(int size) {
ABC::buffer = new char[size];
}
}
// in other file:
ABC tempVar(atoi(argv[1]));
but this doesn't seem to work. I get errors like:
Error 2 error LNK2001: unresolved external symbol "public: static char * ABC::buffer" (?buffer@ABC@@2PADA) gpslib.lib
How can I fix this?