compilation problems with static data member
I am getting some problems with compiling the following code.
It gives me the following error. I think its ver staright forward and its just that I am missing something. pls help.
I want to access statis data member which is an array of some other class type.
error message:
CalculateMovieSimilarity.cpp:(.text+0x3ce): undefined reference to `CalculateMovieSimilarity::ifileObject'
CalculateMovieSimilarity.cpp:(.text+0x4a7): undefined reference to `CalculateMovieSimilarity::ifileObject'
CalculateMovieSimilarity.cpp:(.text+0x547): undefined reference to `CalculateMovieSimilarity::ifileObject'
collect2: ld returned 1 exit status
and following is the code snippet
Code:
class IndexFileObject
{
public: int count;
int referencebytepos;
int relativebytepos[DATEINTERVALS];
};
class CalculateMovieSimilarity
{
public: static string indexfilename;
static IndexFileObject ifileObject[17770];
static void createifileObject();
};
void CalculateMovieSimilarity::createifileObject(){
CalculateMovieSimilarity::ifileObject[moviecount].relativebytepos[index]=atoi(relativebytepos.c_str());
}