gtest 编译错误

wukstaka 2020-03-09 07:12:58

Scanning dependencies of target gtest
[ 25%] Building CXX object CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /usr/src/gtest/src/gtest-all.cc:42:0:
/usr/src/gtest/src/gtest.cc: In destructor ‘virtual testing::Test::~Test()’:
/usr/src/gtest/src/gtest.cc:1897:10: error: type ‘const class testing::internal::scoped_ptr<testing::internal::GTestFlagSaver>’ argument given to ‘delete’, expected pointer
delete gtest_flag_saver_;
^~~~~~~~~~~~~~~~~
/usr/src/gtest/src/gtest.cc: At global scope:
/usr/src/gtest/src/gtest.cc:2177:1: error: prototype for ‘testing::TestInfo::TestInfo(const string&, const string&, const char*, const char*, testing::internal::TypeId, testing::internal::TestFactoryBase*)’ does not match any in class ‘testing::TestInfo’
TestInfo::TestInfo(const std::string& a_test_case_name,
^~~~~~~~
In file included from /usr/local/include/gtest/internal/gtest-internal.h:40:0,
from /usr/local/include/gtest/gtest.h:58,
from /usr/src/gtest/src/gtest-all.cc:39:
/usr/local/include/gtest/gtest.h:772:3: error: candidates are: testing::TestInfo::TestInfo(const testing::TestInfo&)
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
^
In file included from /usr/src/gtest/src/gtest-all.cc:39:0:
/usr/local/include/gtest/gtest.h:728:3: error: testing::TestInfo::TestInfo(const string&, const string&, const char*, const char*, testing::internal::CodeLocation, testing::internal::TypeId, testing::internal::TestFactoryBase*)
TestInfo(const std::string& test_case_name,
^~~~~~~~
In file included from /usr/src/gtest/src/gtest-all.cc:42:0:
/usr/src/gtest/src/gtest.cc: In function ‘testing::TestInfo* testing::internal::MakeAndRegisterTestInfo(const char*, const char*, const char*, const char*, testing::internal::TypeId, testing::internal::SetUpTestCaseFunc, testing::internal::TearDownTestCaseFunc, testing::internal::TestFactoryBase*)’:
/usr/src/gtest/src/gtest.cc:2227:45: error: no matching function for call to ‘testing::TestInfo::TestInfo(const char*&, const char*&, const char*&, const char*&, const void*&, testing::internal::TestFactoryBase*&)’
fixture_class_id, factory);
^
In file included from /usr/local/include/gtest/internal/gtest-internal.h:40:0,
from /usr/local/include/gtest/gtest.h:58,
from /usr/src/gtest/src/gtest-all.cc:39:
/usr/local/include/gtest/gtest.h:772:3: note: candidate: testing::TestInfo::TestInfo(const testing::TestInfo&)
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
^
/usr/local/include/gtest/gtest.h:772:3: note: candidate expects 1 argument, 6 provided
In file included from /usr/src/gtest/src/gtest-all.cc:39:0:
/usr/local/include/gtest/gtest.h:728:3: note: candidate: testing::TestInfo::TestInfo(const string&, const string&, const char*, const char*, testing::internal::CodeLocation, testing::internal::TypeId, testing::internal::TestFactoryBase*)
TestInfo(const std::string& test_case_name,
^~~~~~~~
/usr/local/include/gtest/gtest.h:728:3: note: candidate expects 7 arguments, 6 provided
In file included from /usr/src/gtest/src/gtest-all.cc:42:0:
/usr/src/gtest/src/gtest.cc: In function ‘void testing::internal::InitGoogleTestImpl(int*, CharType**)’:
/usr/src/gtest/src/gtest.cc:4983:3: error: ‘g_argvs’ was not declared in this scope
g_argvs.clear();
^~~~~~~
In file included from /usr/src/gtest/src/gtest-all.cc:43:0:
/usr/src/gtest/src/gtest-death-test.cc: In function ‘void testing::internal::SplitString(const string&, char, std::vector<std::__cxx11::basic_string<char> >*)’:
/usr/src/gtest/src/gtest-death-test.cc:1208:13: error: ‘void testing::internal::SplitString(const string&, char, std::vector<std::__cxx11::basic_string<char> >*)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
static void SplitString(const ::std::string& str, char delimiter,
^~~~~~~~~~~
In file included from /usr/local/include/gtest/gtest.h:58:0,
from /usr/src/gtest/src/gtest-all.cc:39:
/usr/local/include/gtest/internal/gtest-internal.h:612:6: note: previous declaration of ‘void testing::internal::SplitString(const string&, char, std::vector<std::__cxx11::basic_string<char> >*)’
void SplitString(const ::std::string& str, char delimiter,
^~~~~~~~~~~
In file included from /usr/src/gtest/src/gtest-all.cc:45:0:
/usr/src/gtest/src/gtest-port.cc: In function ‘const char* testing::internal::StringFromGTestEnv(const char*, const char*)’:
/usr/src/gtest/src/gtest-port.cc:798:13: error: ambiguating new declaration of ‘const char* testing::internal::StringFromGTestEnv(const char*, const char*)’
const char* StringFromGTestEnv(const char* flag, const char* default_value) {
^~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/gtest/internal/gtest-internal.h:40:0,
from /usr/local/include/gtest/gtest.h:58,
from /usr/src/gtest/src/gtest-all.cc:39:
/usr/local/include/gtest/internal/gtest-port.h:2549:13: note: old declaration ‘std::__cxx11::string testing::internal::StringFromGTestEnv(const char*, const char*)’
std::string StringFromGTestEnv(const char* flag, const char* default_val);
^~~~~~~~~~~~~~~~~~
In file included from /usr/src/gtest/src/gtest-all.cc:48:0:
/usr/src/gtest/src/gtest-typed-test.cc: In member function ‘const char* testing::internal::TypedTestCasePState::VerifyRegisteredTestNames(const char*, int, const char*)’:
/usr/src/gtest/src/gtest-typed-test.cc:71:31: error: ‘defined_test_names_’ was not declared in this scope
for (DefinedTestIter it = defined_test_names_.begin();
^~~~~~~~~~~~~~~~~~~
/usr/src/gtest/src/gtest-typed-test.cc:88:29: error: ‘defined_test_names_’ was not declared in this scope
for (DefinedTestIter it = defined_test_names_.begin();
^~~~~~~~~~~~~~~~~~~
CMakeFiles/gtest.dir/build.make:62: recipe for target 'CMakeFiles/gtest.dir/src/gtest-all.cc.o' failed
make[2]: *** [CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
CMakeFiles/Makefile2:77: recipe for target 'CMakeFiles/gtest.dir/all' failed
make[1]: *** [CMakeFiles/gtest.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
...全文
695 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
wukstaka 2020-03-09
  • 打赏
  • 举报
回复
成功把环境玩崩了

65,208

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧