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.
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;
}