Our project embeds googlemock into a larger CMake project and we use the -std=c++0x flag on gcc.
Scanning dependencies of target gmock
[ 14%] Building CXX object CMakeFiles/gmock.dir/gtest/src/gtest-all.cc.o
[ 28%] Building CXX object CMakeFiles/gmock.dir/src/gmock-all.cc.o
In file included from /mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-spec-builders.h:75:0,
from /mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-generated-function-mockers.h:43,
from /mnt/data1/Code/gmock-1.7.0/include/gmock/gmock.h:61,
from /mnt/data1/Code/gmock-1.7.0/src/gmock-all.cc:40:
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1485:41: sorry, unimplemented: cannot expand ‘Tail ...’ into a fixed-length argument list
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1486:63: error: template argument 2 is invalid
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h: In static member function ‘static testing::internal::MatcherList<kSize, Head, Tail>::ListType testing::internal::MatcherList<kSize, Head, Tail>::BuildList(const Head&, const Tail& ...)’:
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1493:20: error: expected primary-expression before ‘(’ token
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1493:30: error: ‘MatcherListTail’ is not a class, namespace, or enumeration
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h: In static member function ‘static testing::Matcher<T> testing::internal::MatcherList<kSize, Head, Tail>::CreateMatcher(const ListType&)’:
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1503:37: error: request for member ‘first’ in ‘matchers’, which is of non-class type ‘const ListType {aka const int}’
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1505:22: error: request for member ‘second’ in ‘matchers’, which is of non-class type ‘const ListType {aka const int}’
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1502:22: error: expected primary-expression before ‘(’ token
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1503:37: error: request for member ‘first’ in ‘matchers’, which is of non-class type ‘const ListType {aka const int}’
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1504:9: error: ‘MatcherListTail’ is not a class, namespace, or enumeration
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1504:50: error: expected primary-expression before ‘,’ token
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1504:68: error: missing template arguments before ‘>’ token
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1505:22: error: request for member ‘second’ in ‘matchers’, which is of non-class type ‘const ListType {aka const int}’
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h: At global scope:
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1548:47: sorry, unimplemented: cannot expand ‘Args ...’ into a fixed-length argument list
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1550:18: error: ‘MatcherListType’ is not a class, namespace, or enumeration
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h: In constructor ‘testing::internal::VariadicMatcher<CombiningMatcher, Args>::VariadicMatcher(const Args& ...)’:
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1536:19: error: ‘MatcherListType’ is not a class, namespace, or enumeration
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h: In member function ‘testing::internal::VariadicMatcher<CombiningMatcher, Args>::operator testing::Matcher<T>() const’:
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1543:12: error: ‘MatcherListType’ is not a class, namespace, or enumeration
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1543:53: error: expected primary-expression before ‘,’ token
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1543:71: error: missing template arguments before ‘>’ token
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h: At global scope:
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1556:1: error: expected unqualified-id before ‘using’
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:1650:1: error: expected unqualified-id before ‘using’
In file included from /mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-spec-builders.h:75:0,
from /mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-generated-function-mockers.h:43,
from /mnt/data1/Code/gmock-1.7.0/include/gmock/gmock.h:61,
from /mnt/data1/Code/gmock-1.7.0/src/gmock-all.cc:40:
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:3954:8: error: ‘AllOfMatcher’ in namespace ‘testing::internal’ does not name a type
/mnt/data1/Code/gmock-1.7.0/include/gmock/gmock-matchers.h:3959:8: error: ‘AnyOfMatcher’ in namespace ‘testing::internal’ does not name a type
make[2]: *** [CMakeFiles/gmock.dir/src/gmock-all.cc.o] Error 1
make[1]: *** [CMakeFiles/gmock.dir/all] Error 2
make: *** [all] Error 2
1. cd gmock-1.7.0
2. mkdir build && cd build
3. make
The expected output is that the code compiles and gmock/gtest libraries are produced.
Using googlemock version 1.7.0 on Ubuntu 12.04 with gcc version: gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3