Googletest: Build failure

Created on 26 Sep 2018  Β·  7Comments  Β·  Source: google/googletest

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

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.

All 7 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apivovarov picture apivovarov  Β·  3Comments

ElectricRCAircraftGuy picture ElectricRCAircraftGuy  Β·  4Comments

maygamboa picture maygamboa  Β·  6Comments

kdawgwilk picture kdawgwilk  Β·  3Comments

Joebeazelman picture Joebeazelman  Β·  5Comments