I have this in my .hpp file:
class MD
{
public:
static const开发者_运维知识库 int Blk = 0;
}
And this in a method in .mm file that includes the .hpp file:
int i = MD.Blk;
the compiler says error: expected primary-expression before '.' token
on this line.
Try the ::
operator
int i = MD::Blk;
The correct way to refer static class member variables is using the ::
operator, like this:
int i = MD::Blk;
精彩评论