Google mock compile error (error: ‘<function name>’ is not a type)
The below error message:
error: ‘vPrintStatus’ is not a type
indicates that MOCK_CONST_METHOD0(vPrintStatus, void());
was parsed by a compiler as a declaration of a member function, named MOCK_CONST_METHOD0
, taking two parameters, one of type vPrintStatus
(hence the error), and another being a function pointer type (void(*)()
after adjustment). Clearly, this means that the definition of macro MOCK_CONST_METHOD0
is not visible to the translation unit the mock declaration is part of. Make sure you have included <gmock/gmock.h>
to that file.