C
Connell Gauld
Hi,
I'm using VC++.
I have a class called exClass defined in exClass.h
exClass has a static variable, declared like this in the public section.
static int exStaticVar;
Below the class definition I have initialised (right word?) it like this
int exClass::nextFree;
Now below is a code fragment from a non-static function in another class
(exClass.h was included at the top of the .cpp file).
exClass * otherClass::doFunction(args)
{
if (condition)
{
for(loop_stuff)
{
if(condition)
{
// The line below works fine.
someFunction(exClass.exStaticVar);
// The line below does not.
exClass.exStaticVar++;
}
return gModel;
}
} else {
return 0;
}
}
The error caused is below and suggests that it cannot find exClass which
it must be able to do since it did it in the function.
error C2143: syntax error : missing ';' before '.'
Using VC++.
Any help greatly appreciated,
Connell
I'm using VC++.
I have a class called exClass defined in exClass.h
exClass has a static variable, declared like this in the public section.
static int exStaticVar;
Below the class definition I have initialised (right word?) it like this
int exClass::nextFree;
Now below is a code fragment from a non-static function in another class
(exClass.h was included at the top of the .cpp file).
exClass * otherClass::doFunction(args)
{
if (condition)
{
for(loop_stuff)
{
if(condition)
{
// The line below works fine.
someFunction(exClass.exStaticVar);
// The line below does not.
exClass.exStaticVar++;
}
return gModel;
}
} else {
return 0;
}
}
The error caused is below and suggests that it cannot find exClass which
it must be able to do since it did it in the function.
error C2143: syntax error : missing ';' before '.'
Using VC++.
Any help greatly appreciated,
Connell