Why the compiler does not recognize Google Mock wildcard?
Asked Answered
T

1

15

When I try to use:

ON_CALL(mock, foo(_))

Compilation error is thrown:

Error   1   error C2065: '_' : undeclared identifier    

I am using visual studio 2012.

Transient answered 28/1, 2015 at 6:13 Comment(0)
S
34

undeclared identifier always means that compiler does not understand what it (i.e. _) is. So perhaps you forgot

#include <gtest/gtest.h>
#include <gmock/gmock.h>

or

using::testing::_;

Refer to examples and check.

Simmon answered 28/1, 2015 at 6:24 Comment(2)
or using namespace testingEmf
or using ::testing::DoAll;Mendenhall

© 2022 - 2024 — McMap. All rights reserved.