Build steps:
mkdir build
cd build
cmake ..
make
Log:
In file included from /home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-spec-builders.h:71:0,
from /home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h:44,
from /home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock.h:62,
from /home/ubuntu/Pratik/googletest/googlemock/src/gmock-all.cc:39:
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5173:19: error: variadic templates only available with -std=c++11 or -std=gnu++11 [-Werror]
template
^
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5174:50: error: βdecayβ in namespace βstdβ does not name a template type
internal::ElementsAreMatcher
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5174:55: error: expected template-argument before β<β token
internal::ElementsAreMatcher
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5174:55: error: expected β>β before β<β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5175:36: error: template argument 1 is invalid
ElementsAre(const Args&... matchers) {
^
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5175:38: error: expected β::β before β{β token
ElementsAre(const Args&... matchers) {
^
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5175:38: error: expected identifier before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5175:38: error: expected template-argument before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5175:38: error: expected β>β before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5175:38: error: template argument 1 is invalid
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5175:38: error: expected β::β before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5175:38: error: expected unqualified-id before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5181:19: error: variadic templates only available with -std=c++11 or -std=gnu++11 [-Werror]
template
^
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5183:25: error: βdecayβ in namespace βstdβ does not name a template type
tuple
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5183:30: error: expected template-argument before β<β token
tuple
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5183:30: error: expected β>β before β<β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5184:45: error: template argument 1 is invalid
UnorderedElementsAre(const Args&... matchers) {
^
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5184:47: error: expected β::β before β{β token
UnorderedElementsAre(const Args&... matchers) {
^
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5184:47: error: expected identifier before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5184:47: error: expected template-argument before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5184:47: error: expected β>β before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5184:47: error: template argument 1 is invalid
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5184:47: error: expected β::β before β{β token
/home/ubuntu/Pratik/googletest/googlemock/include/gmock/gmock-matchers.h:5184:47: error: expected unqualified-id before β{β token
cc1plus: all warnings being treated as errors
googlemock/CMakeFiles/gmock.dir/build.make:62: recipe for target 'googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o' failed
make[2]: * [googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o] Error 1
CMakeFiles/Makefile2:89: recipe for target 'googlemock/CMakeFiles/gmock.dir/all' failed
make[1]: [googlemock/CMakeFiles/gmock.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: ** [all] Error 2
I encountered this error with GCC 5.4 and Clang 3.8. (the commit is 75e834700d19aa373b428c7c746f951737354c28)
I ran into this issue before. I managed to fix those errors by adding set(CMAKE_CXX_STANDARD 11) in the root CMakeLists.txt file.
googletest requires c++ 11
googletest requires C++ 11
@gennadiycivil Why don't you specify that in CMakeLists.txt?
@mizuno-gsinet Thank you for the suggestion. Please feel free to open a PR
I submitted a pull request that should fix this issue.
Most helpful comment
I ran into this issue before. I managed to fix those errors by adding set(CMAKE_CXX_STANDARD 11) in the root CMakeLists.txt file.