c++ - 从 GCC 5.4 升级到 GCC 7.2 后 Eigen 3.3.4 出现警告

标签 c++ gcc eigen eigen3

当我使用 GCC 5.4 使用 -Wall -Werror 编译代码时,它工作正常。当我使用 GCC 7.2(从源代码构建为 native 编译器)尝试它时,它给出了:

error: enum constant in boolean context [-Werror=int-in-bool-context]
 MayLinearVectorize = bool(MightVectorize) && MayLinearize && DstHasDirectAccess

重现问题的小示例:

#include <Eigen/Dense>

using namespace Eigen;

int main()
{
    Matrix<double,Dynamic,1> v = Matrix<double,Dynamic,1>::Constant(5, 1);
    return 0;
}

使用g++7 eigtrivial.cpp -I$EIGEN_DIR -Wall -Werror编译。

如果我在没有 -Werror 的情况下尝试,我会收到警告,但它会编译,并且我所有的(少数)测试都通过了 - 据我所知,它很好。但是,我想保留所有警告和 -Werror 启用状态。有人能解释一下吗?

最佳答案

正如 ggael 所说,这个问题已被修复,但尚未包含在官方 tarball 中。从 Mercurial 存储库(目前版本为 3.3.90)克隆并在我的代码中使用它解决了该问题。

关于c++ - 从 GCC 5.4 升级到 GCC 7.2 后 Eigen 3.3.4 出现警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47483026/

相关文章:

c++ - 为什么虚拟表中有两个虚拟析构函数,非虚拟函数的地址在哪里(gcc4.6.3)

c++ - Eigen 中的点积乘以转置?

c++ - C++中的线程间通信

c++ - Boost Spirit 换行和输入结束

c++ - 在 Debian/squeeze 上查找 libstdc++ 中丢失的符号

c - 错误: 'for' loop initial declarations are only allowed in c99 mode

gcc - Keil vs GCC for ARM7?

c++ - 矩阵乘法优化

c++ - Eigen :如何从稀疏矩阵中删除初始化系数

c++ - fatal error C1083 : Cannot open include file: 'Item.h” ': No such file or directory