gpt4 book ai didi

compiler-errors - 来自gtest-all.cc的Google测试编译错误

转载 作者:行者123 更新时间:2023-12-02 10:48:43 25 4
gpt4 key购买 nike

我正在尝试用我的测试用例来编译google test,但是不能。我没有对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

也找不到来自Google的任何帮助.. !!预先感谢您的帮助。

最佳答案

当我尝试按照以下帖子手动安装它时,遇到了相同的问题:Arturo Ruiz Mañas' response
它没有用,所以我在那篇文章中也厌倦了另一个选择,但是我已经在/usr/local/include中添加了标题。

检查是否添加了旧标题,然后尝试安装@detrick版本。

关于compiler-errors - 来自gtest-all.cc的Google测试编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18320402/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com