简体   繁体   English

linux上的英特尔编译器的特征库编译错误

[英]Eigen library compilation error with intel compiler on linux

I am successfully able to compile Eigen on cygwin with mingw compilers.我能够使用 mingw 编译器成功地在 cygwin 上编译 Eigen。

When compiling on linux with intel C++ compiler, I get the following error.在 linux 上使用 intel C++ 编译器进行编译时,出现以下错误。

I am using the Eigen library to solve AX=B.我正在使用 Eigen 库来解决 AX=B。

I am using Eigen3.3-rc1.我正在使用 Eigen3.3-rc1。

any idea how to fix this?知道如何解决这个问题吗?

Thanks.谢谢。

./Eigen/src/Core/CoreEvaluators.h(491): error: call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type return m_wrapper(m_functor,index); ./Eigen/src/Core/CoreEvaluators.h(491):错误:调用类类型的对象没有适当的 operator() 或转换函数到函数指针类型return m_wrapper(m_functor,index); detected during: instantiation of "Eigen::CwiseNullaryOp::CoeffReturnType Eigen::internal::evaluator>::coeff(IndexType) const [with NullaryOp=Eigen::internal::scalar_constant_op, PlainObjectType=Eigen::Matrix, IndexType=long]" at line 637 of "./Eigen/src/Core/AssignEvaluator.h" .在以下过程中检测到:“Eigen::CwiseNullaryOp::CoeffReturnType Eigen::internal::evaluator>::coeff(IndexType) const [with NullaryOp=Eigen::internal::scalar_constant_op,PlainObjectType=Eigen::Matrix,IndexType=long ]" 在 "./Eigen/src/Core/AssignEvaluator.h" 的第 637 行。 . . . . error continues错误继续

Edit: Larger error message is as follows.编辑:较大的错误消息如下。

./Eigen/src/Core/CoreEvaluators.h(491): error: call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type
  return m_wrapper(m_functor,index);
         ^
      detected during:
        instantiation of "Eigen::CwiseNullaryOp<NullaryOp, PlainObjectType>::CoeffReturnType Eigen::internal::evaluator<Eigen::CwiseNullaryOp<NullaryOp, PlainObjectType>>::coeff(IndexType) const [with NullaryOp=Eigen::internal::scalar_constant_op<double>, PlainObjectType=Eigen::Matrix<double, -1, 1, 0, -1, 1>, IndexType=long]" at line 637 of "./Eigen/src/Core/AssignEvaluator.h"
        instantiation of "void Eigen::internal::generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>::assignCoeff(Eigen::Index={ptrdiff_t={long}}) [with DstEvaluatorTypeT=Eigen::internal::evaluator<Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0>>, -1, -1, false>, -1, 1, true>, -1, 1, false>>,
                  SrcEvaluatorTypeT=Eigen::internal::evaluator<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>>, Functor=Eigen::internal::div_assign_op<double, double>, Version=0]" at line 390 of "./Eigen/src/Core/AssignEvaluator.h"
        instantiation of "void Eigen::internal::unaligned_dense_assignment_loop<false>::run(Kernel &, Eigen::Index={ptrdiff_t={long}}, Eigen::Index={ptrdiff_t={long}}) [with Kernel=Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0>>, -1, -1, false>, -1, 1, true>, -1, 1, false>>,
                  Eigen::internal::evaluator<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>>, Eigen::internal::div_assign_op<double, double>, 0>]" at line 413 of "./Eigen/src/Core/AssignEvaluator.h"
        instantiation of "void Eigen::internal::dense_assignment_loop<Kernel, 3, 0>::run(Kernel &) [with Kernel=Eigen::internal::generic_dense_assignment_kernel<Eigen::internal::evaluator<Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0>>, -1, -1, false>, -1, 1, true>, -1, 1, false>>, Eigen::internal::evaluator<Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>>,
                  Eigen::internal::div_assign_op<double, double>, 0>]" at line 713 of "./Eigen/src/Core/AssignEvaluator.h"
        instantiation of "void Eigen::internal::call_dense_assignment_loop(const DstXprType &, const SrcXprType &, const Functor &) [with DstXprType=Eigen::Block<Eigen::Block<Eigen::Block<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 0, Eigen::Stride<0, 0>>, -1, -1, false>, -1, 1, true>, -1, 1, false>, SrcXprType=Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>, Functor=Eigen::internal::div_assign_op<double, double>]" at line
                  862 of "./Eigen/src/Core/AssignEvaluator.h"
        [ 6 instantiation contexts not shown ]
        instantiation of "void Eigen::internal::partial_lu_inplace(MatrixType &, TranspositionType &, TranspositionType::StorageIndex &) [with MatrixType=Eigen::Matrix<double, -1, -1, 0, -1, -1>, TranspositionType=Eigen::Transpositions<-1, -1, int>]" at line 530 of "./Eigen/src/LU/PartialPivLU.h"
        instantiation of "void Eigen::PartialPivLU<_MatrixType>::compute() [with _MatrixType=Eigen::Matrix<double, -1, -1, 0, -1, -1>]" at line 131 of "./Eigen/src/LU/PartialPivLU.h"
        instantiation of "Eigen::PartialPivLU<_MatrixType> &Eigen::PartialPivLU<_MatrixType>::compute(const Eigen::EigenBase<OtherDerived> &) [with _MatrixType=Eigen::Matrix<double, -1, -1, 0, -1, -1>, InputType=Eigen::Matrix<double, -1, -1, 0, -1, -1>]" at line 323 of "./Eigen/src/LU/PartialPivLU.h"
        instantiation of "Eigen::PartialPivLU<_MatrixType>::PartialPivLU(const Eigen::EigenBase<OtherDerived> &) [with _MatrixType=Eigen::Matrix<double, -1, -1, 0, -1, -1>, InputType=Eigen::Matrix<double, -1, -1, 0, -1, -1>]" at line 606 of "./Eigen/src/LU/PartialPivLU.h"
        instantiation of "const Eigen::PartialPivLU<Eigen::DenseBase<Derived>::PlainObject> Eigen::MatrixBase<Derived>::lu() const [with Derived=Eigen::Matrix<double, -1, -1, 0, -1, -1>]" at line 245 of "Matrix.cpp"

Here is the relevant code that uses Eigen这是使用 Eigen 的相关代码

#include <Eigen/Eigen>
using Eigen::MatrixXd;
using Eigen::VectorXd;

int solveAXBEigen(double *a, double *b, double *x, int n) {
    MatrixXd A(n, n);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            A(i, j) = a[n * i + j];
        }
    }
    VectorXd B(n);
    for (int i = 0; i < n; i++) {
        B(i) = b[i];
    }
    VectorXd X = A.lu().solve(B);
    for (int i = 0; i < n; i++) {
        x[i] = X(i);
    }
    return 0;
}

Typical C++ problem.典型的 C++ 问题。 C++ allows the definition of "function objects" with overloaded "()" operators that permit them to be called. C++ 允许使用允许调用它们的重载“()”运算符来定义“函数对象”。 it also allows templates.它还允许使用模板。 Somewhere in the interaction of operator resolution and templates, something has gone wrong, either in the compiler or the code.在运算符解析和模板的交互中,编译器或代码中出现了错误。 It's now going to be a difficult one to disentangle.现在将是一个难以解开的问题。 The whole thing will be so wrapped up in object-orientation and generic programming constructs that it will be hard to isolate the problem.整个事情将如此包裹在面向对象和通用编程结构中,以至于很难隔离问题。 However start with the line where the error is generated, and try to see where the code attempts to define the () operator for that object.然而,从产生错误的那一行开始,并尝试查看代码尝试为该对象定义 () 运算符的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM