|
Answer» Hi,
when I compile the code below, I get the following ERROR messages:
[linker error] undefined REFERENCE to `sample_class::UsingFile' ld returned 1 exit status [Build Error] ["Class] Error 1
How do I solve this problem? Thanks.
Code: [Select]class sample_class { PUBLIC: sample_class() { UsingFile = 0; } ~sample_class() { --UsingFile; } static bool IsFileInUse(); private: static int UsingFile; };
bool sample_class::IsFileInUse() { if(UsingFile != 0) { cout << "File in use" << endl << endl; return (true); }
}
int main(int argc, char *argv[]) {
SYSTEM("PAUSE"); return EXIT_SUCCESS; }
|