My actual code (class name changed, some cut, as it is company confidential, but there is only one compiler error, so what I cut should not be affecting things)
class Xyz
{
public:
virtual void vPrintStatus() const;
};
and its mock
class MockXyz : public Xyz
{
public:
MOCK_CONST_METHOD0(vPrintStatus,
void());
};
Which gives me a compiler error : error: ‘vPrintStatus’ is not a type
#includes, etc are OK. The compiler is obviously finding vPrintStatus
, as, if I change it to something undefined:
MOCK_CONST_METHOD0(independence,
void());
I get error: ‘independence’ has not been declared
.
So, the compiler finds vPrintStatus
and appears to know its type (or, at least, what type it is not).
I am sure that I am following the syntax for MOCK_CONST_METHOD0
- the mock macro shoudl be expecting a function name, not a type, as its first parameter.
What am I doing wrong?
MOCK_CONST_METHOD0
is parsed as a member function name, not a macro, make sure the includes are correct – YourselfXyz
has a virtual destructor. – Embry