我正在尝试用我的测试用例编译谷歌测试,但不能。我没有对 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
谷歌也找不到任何帮助..!! 提前感谢您的帮助。