gpt4 book ai didi

c++ - 错误 : This compiler appears to be too old to be supported by Eigen

转载 作者:行者123 更新时间:2023-12-05 01:51:51 51 4
gpt4 key购买 nike

我正在尝试编译一个包含 eigen 库的项目,但出现此错误:

In file included from /home/--/--/--/Eigen/Core:19,
from /home/--/--/--/Eigen/Geometry:11,
from /usr/include/rl-0.7.0/rl/math/Transform.h:34,
from /home/--/--/--/example.cpp:2:
/home/--/--/--/Eigen/src/Core/util/Macros.h:674:2: error: #error This compiler appears to be too old to be supported by Eigen
674 | #error This compiler appears to be too old to be supported by Eigen
| ^~~~~

我正在使用:

  • Ubuntu 20.04
  • CMake 3.16.3
  • VSCode 编译器 GCC 10.3.1
  • Eigen 3.4.90

问题似乎与 Macros.h 文件中的这些行有关:

// The macros EIGEN_HAS_CXX?? defines a rough estimate of available c++ features
// but in practice we should not rely on them but rather on the availability of
// individual features as defined later.
// This is why there is no EIGEN_HAS_CXX17.
#if EIGEN_MAX_CPP_VER<14 || EIGEN_COMP_CXXVER<14 || (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1900) || \
(EIGEN_COMP_ICC && EIGEN_COMP_ICC < 1500) || (EIGEN_COMP_NVCC && EIGEN_COMP_NVCC < 80000) || \
(EIGEN_COMP_CLANG && ((EIGEN_COMP_CLANG<309) || (defined(__apple_build_version__) && (__apple_build_version__ < 9000000)))) || \
(EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<51)
#error This compiler appears to be too old to be supported by Eigen
#endif

你知道如何解决这个错误吗?

最佳答案

正如@Lala5th 所建议的,通过更改 C++ 标准,问题得以解决。

我已经修改了 CMakeLists.txt:

来自:

set(CMAKE_CXX_STANDARD 11)

收件人:

set(CMAKE_CXX_STANDARD 17)

(它也适用于 14)

关于c++ - 错误 : This compiler appears to be too old to be supported by Eigen,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71953477/

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