我正在尝试用我的测试用例编译谷歌测试,但不能。我没有对gtest_main.cc或gtest-all.cc文件进行任何更改,即使这样我也无法编译这些文件。 我收到以下错误:
g++ -g -Wall -Wextra -Werror -I../../../ext/gtest-1.6.0/include -I../../../ext/gtest-1.6.0 -c ../../../ext/gtest-1.6.0/src/gtest-all.cc
In file included from ../../../ext/gtest-1.6.0/src/gtest.cc:35,
from ../../../ext/gtest-1.6.0/src/gtest-all.cc:42:
../../../ext/gtest-1.6.0/include/gtest/gtest-spi.h:52: error: expected initializer before ‘:’ token
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/ext/atomicity.h:34,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/bits/ios_base.h:41,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/ios:43,
from /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/ostream:40,
from ../../../ext/gtest-1.6.0/src/gtest.cc:46,
from ../../../ext/gtest-1.6.0/src/gtest-all.cc:42:
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux/bits/gthr.h:30: error: expected ‘}’ before end of line
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux/bits/gthr.h:30: error: expected declaration before end of line
但我可以编译gtest_main.cc而不会出现任何错误:
g++ -g -Wall -Wextra -Werror -I../../../ext/gtest-1.6.0/include -I../../../ext/gtest-1.6.0 -c ../../../ext/gtest-1.6.0/src/gtest-all.cc
无法从谷歌找到任何帮助.. !!提前感谢您的帮助。
答案 0 :(得分:0)
在这篇文章之后,我尝试手动安装它时遇到了同样的问题:Arturo Ruiz Mañas' response。
它没有用,所以我在那篇文章中也厌倦了另一个选择,但是我已经在/usr/local/include
中添加了标题。
检查是否添加了旧标题,然后尝试安装@detrick版本。