2016-10-01 56 views
-1

我可以用mingw编译器成功编译cygwin上的Eigen。使用intel编译器在linux上编译特征库时出错

使用intel C++编译器在Linux上编译时,出现以下错误。

我正在使用特征库来解决AX = B。

我正在使用Eigen3.3-rc1。

任何想法如何解决这个问题?

谢谢。

./Eigen/src/Core/CoreEvaluators.h(491):错误:一个类类型的对象的呼叫,而不适当的运算符()或转换函数指针到功能类型 返回m_wrapper( m_functor,索引); 检测期间: 实例化“Eigen :: CwiseNullaryOp :: CoeffReturnType Eigen :: internal :: evaluator> :: coeff(IndexType)const [与NullaryOp = Eigen :: internal :: scalar_constant_op,PlainObjectType = Eigen :: Matrix,IndexType在“./Eigen/src/Core/AssignEvaluator.h” 的第637行。 。 。 错误继续

编辑:更大的错误信息如下。

./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" 

下面是一个使用本征

#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; 
} 
+1

所有的单元测试都可以用ICC编译,所以请显示触发这个问题的代码行。 – ggael

+0

编辑问题以包含相关代码以及更大的错误消息跟踪。 –

+0

在这里,你的例子用ICC 16.0.2和Eigen 3.3-rc1编译得很好。 – ggael

回答

0

典型的C++问题相关的代码。 C++允许用重载的“()”运算符来定义“函数对象”,以允许它们被调用。它也允许模板。在运算符分辨率和模板交互的某处,无论是在编译器还是代码中都出现了问题。现在将是一个难以解决的难题。整个事情将如此笼罩在面向对象和泛型编程构造中,以至于很难分离出问题。但是,从生成错误的行开始,并尝试查看代码尝试为该对象定义()运算符的位置。

+0

我正在使用外部库,并且不熟悉代码,因此我很难确定问题的根源。仍试图找出..如何解决这个问题? –