【问题标题】:is there any way to use google test tool on gcc 4.5.2 compiler?有没有办法在 gcc 4.5.2 编译器上使用谷歌测试工具?
【发布时间】:2020-01-21 05:59:23
【问题描述】:

我正在使用 google test c++ framwork 来测试我的项目,但遇到一些问题供您参考,请参阅以下编译错误。

src/exclusions/Gtest/../../include/gtest/internal/gtest-port.h:972:37: error: ‘nullptr’ was not declared in this scope
src/exclusions/Gtest/../../include/gtest/internal/gtest-port.h:1316:22: error: expected ‘;’ before ‘override’
src/exclusions/Gtest/../../include/gtest/internal/../gtest-matchers.h:307:37: error: ‘testing::internal::MatcherBase<T>::MatcherBase(const testing::internal::MatcherBase<T>&)’ declared with non-public access cannot be defaulted in the class body
/home/buildserver/rswork25Nov/Dev-UEM-1.2-POC/src/exclusions/Gtest/../../include/gtest/internal/../gtest-matchers.h:308:48: error: ‘testing::internal::MatcherBase<T>& testing::internal::MatcherBase<T>::operator=(const testing::internal::MatcherBase<T>&)’ declared with non-public access cannot be defaulted in the class body
src/exclusions/Gtest/../../include/gtest/internal/gtest-param-util.h:521:74: error: there are no arguments to ‘InstantiationInfo’ that depend on a template parameter, so a declaration of ‘InstantiationInfo’ must be available
src/exclusions/Gtest/../../include/gtest/internal/../gtest-matchers.h:305:61: error: cannot allocate an object of abstract type ‘testing::internal::MatcherInterfaceAdapter<std::basic_string<char> >’

【问题讨论】:

  • 请以正确的格式发布日志以提高可读性。
  • GCC 4.5 已经很老了。您是否考虑过使用更新的编译器?然后您就可以享受对 C++11/14/17 的支持,而您当前的编译器太旧而无法支持。
  • @VaibhavSharma OP 将无法正确格式化(即作为代码),因为系统会告诉他们他们需要用这么多代码提供更多的散文解释。
  • 你至少需要 gcc 4.6 stackoverflow.com/questions/3756473/…

标签: c++ linux googletest gcc4


【解决方案1】:

也许您可以使用旧标签googletest?

比较1.8.1的要求:

Linux Requirements

These are the base requirements to build and use Google Test from a source package (as described below):

GNU-compatible Make or gmake
POSIX-standard shell
POSIX(-2) Regular Expressions (regex.h)
A C++98-standard-compliant compiler

最新的:

Build Requirements

These are the base requirements to build and use Google Test from a source package:

Bazel or CMake. NOTE: Bazel is the build system that googletest is using internally and tests against. CMake is community-supported.

a C++11-standard-compliant compiler

我想您必须做出权衡:与您的工具链兼容googletest 功能。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-31
  • 2014-02-10
  • 1970-01-01
  • 2022-01-13
  • 2012-02-04
相关资源
最近更新 更多