c++ - Eigen 3.3 对 mingw-w64 (GCC 7.1.0) 有很多警告

标签 c++ compiler-warnings eigen eigen3

从mingw-w64 GCC 6.2升级到GCC 7.1(准确的说是migw-w64版本x86_64-7.1.0-posix-sjlj-rt_v5-rev0)后,编译器出现大量警告。例如:

In file included from C:\...\Eigen3_3_3/Eigen/Eigenvalues:45:0,
                 from C:\...\Eigen3_3_3/Eigen/Dense:7,
                 from ..\src\testProject.cpp:5:
C:\...\Eigen3_3_3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h:292:14: warning: optimization attribute on 'int abs(int)' follows definition but the attribute doesn't match [-Wattributes]
   using std::abs;
              ^~~
In file included from C:/.../mingw-w64/x86_64-7.1.0-posix-sjlj-rt_v5-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c++/cmath:47:0,
                 from C:/.../mingw-w64/x86_64-7.1.0-posix-sjlj-rt_v5-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c++/complex:44,
                 from C:\...\Eigen\Eigen3_3_3/Eigen/Core:80,
                 from C:\...\Eigen\Eigen3_3_3/Eigen/Dense:1,
                 from ..\src\testProject.cpp:5:
C:/.../mingw-w64/x86_64-7.1.0-posix-sjlj-rt_v5-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c++/bits/std_abs.h:84:3: note: previous definition of 'constexpr __int128 std::abs(__int128)' was here
   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
   ^~~

这是编译器的问题还是我应该向 Eigen 开发人员报告错误?

最佳答案

这是由于 gcc-7 中的一个错误: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89325

我只是推出了解决方法(即屏蔽警告): http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1724 (将成为 Eigen 3.3.8 的一部分)。

如果您无法从存储库(或默认分支)升级到 3.3 版本,或者等待 3.3.8,您可以将 -Wno-attributes 添加到您的编译标志中。

关于c++ - Eigen 3.3 对 mingw-w64 (GCC 7.1.0) 有很多警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44532934/

相关文章:

ios - 我可以忽略有关太多属性的 Cora Data 警告吗?

eigen - 如何将特征库矩阵或向量类型转换为字符串?

c++ - 使用 Eigen 库的 mingw 出现未知错误

c++ - 特征表达式模板比指数的手动循环慢

c++ - 使用成员函数 top() 从 priority_queue 获取元素

c++ - QVideoWidget 独立。窗口关闭时如何停止视频?

c++ - if 语句不比较我的字符串 c++ 中的数值

c# - 如何解决 "The ' configuration' element is not declared“C#.net 中的警告消息

C++ 备注 : operands are evaluated in unspecified order

c++ - 在 C++ 中相互引用 bool 指针的正确方法