Eigen 3.3对mingw-w64(GCC 7.1.0)有许多警告

时间:2017-06-13 23:05:37

标签: 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)后,编译器会发出大量警告。 e.g:

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开发人员报告错误?

1 个答案:

答案 0 :(得分:1)

这是由于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