My Problem is the following:
I have a class with static counter. I set this counter as volatile because I use this variable in multithreaded environment.
class.h
class myClass
{
public:
volatile static int mCounter;
(...)
};
class.cpp
int myclass::mCounter = 0;
In CPP file, I initialize it, and I obtain the following compilation error:
'mCounter' : redefinition; different type modifiers
Why ?
Thanks in Advance.
You need to repeat the "volatile" on that line as well.