特征编译错误:没有匹配函数用于调用

时间:2014-12-05 22:28:21

标签: c++ qt5 eigen

我正在尝试在win32 Vista机器上编译的Qt5项目中使用Eigen 3.2.2。当设置为一个简单的C ++项目时,使用Eigen库的代码在我的OSX计算机上编译得很好。当我将它添加到Windows机器上的Qt项目时,我得到以下两个错误:

<ProjectDir>\3rdParty\eigen-3.2.2\Eigen\src\Core\util\BlasUtil.h:198: error: no matching function for call to 'Eigen::internal::blas_traits<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<float>, const Eigen::ReturnByValue<Eigen::internal::inverse_impl<Eigen::Block<Eigen::Matrix<float, 4, 4>, -1, -1, false> > > > >::extract(const type&)'
   static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
                                                                                                  ^
<ProjectDir>\3rdParty\eigen-3.2.2\Eigen\src\Core\util\BlasUtil.h:198: candidate is:
<ProjectDir>\3rdParty\eigen-3.2.2\Eigen\src\Core\util\BlasUtil.h:169: static const XprType& Eigen::internal::blas_traits<XprType>::extract(const XprType&) [with XprType = Eigen::ReturnByValue<Eigen::internal::inverse_impl<Eigen::Block<Eigen::Matrix<float, 4, 4>, -1, -1, false> > >; Eigen::internal::blas_traits<XprType>::ExtractType = const Eigen::ReturnByValue<Eigen::internal::inverse_impl<Eigen::Block<Eigen::Matrix<float, 4, 4>, -1, -1, false> > >&]
   static inline ExtractType extract(const XprType& x) { return x; }
                             ^
<ProjectDir>\3rdParty\eigen-3.2.2\Eigen\src\Core\util\BlasUtil.h:169: note:   no known conversion for argument 1 from 'const type {aka const Eigen::Matrix<float, -1, -1, 0, 4, 4>}' to 'const Eigen::ReturnByValue<Eigen::internal::inverse_impl<Eigen::Block<Eigen::Matrix<float, 4, 4>, -1, -1, false> > >&'


<ProjectDir>\3rdParty\eigen-3.2.2\Eigen\src\Core\util\BlasUtil.h:200: error: no matching function for call to 'Eigen::internal::blas_traits<Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<float>, const Eigen::ReturnByValue<Eigen::internal::inverse_impl<Eigen::Block<Eigen::Matrix<float, 4, 4>, -1, -1, false> > > > >::extractScalarFactor(const type&)'
{ return x.functor().m_other * Base::extractScalarFactor(x.nestedExpression()); }
                                                                            ^
<ProjectDir>\3rdParty\eigen-3.2.2\Eigen\src\Core\util\BlasUtil.h:200: candidate is:
<ProjectDir>\3rdParty\eigen-3.2.2\Eigen\src\Core\util\BlasUtil.h:170: static const Scalar Eigen::internal::blas_traits<XprType>::extractScalarFactor(const XprType&) [with XprType = Eigen::ReturnByValue<Eigen::internal::inverse_impl<Eigen::Block<Eigen::Matrix<float, 4, 4>, -1, -1, false> > >; Eigen::internal::blas_traits<XprType>::Scalar = float]
static inline const Scalar extractScalarFactor(const XprType&) { return Scalar(1); }
                           ^
<ProjectDir>\3rdParty\eigen-3.2.2\Eigen\src\Core\util\BlasUtil.h:170: note:   no known conversion for argument 1 from 'const type {aka const Eigen::Matrix<float, -1, -1, 0, 4, 4>}' to 'const Eigen::ReturnByValue<Eigen::internal::inverse_impl<Eigen::Block<Eigen::Matrix<float, 4, 4>, -1, -1, false> > >&'

错误指向Eigen \ src \ Core \ util \ BlasUtil.h中标记的行:

// pop scalar multiple
template<typename Scalar, typename NestedXpr>
struct blas_traits<CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> >
 : blas_traits<NestedXpr>
{
  typedef blas_traits<NestedXpr> Base;
  typedef CwiseUnaryOp<scalar_multiple_op<Scalar>, NestedXpr> XprType;
  typedef typename Base::ExtractType ExtractType;
// Error 1 on following line
  static inline ExtractType extract(const XprType& x) { return Base::extract(x.nestedExpression()); }
  static inline Scalar extractScalarFactor(const XprType& x)
// Error 2 on following line
  { return x.functor().m_other * Base::extractScalarFactor(x.nestedExpression()); }
};

什么会导致这些错误?我对C ++很陌生,对Qt和Qt Creator来说更是如此,所以我可能错过了一些基本的东西。如果是这种情况,请指出我正确的方向,我将开始挖掘。谢谢!

编辑:
似乎触发错误的行看起来像这样:

Eigen::Matrix4f mat1;
Eigen::Matrix<float, 3, 1> mat2, result;
// fill and work with matrices...
result = -1.0 * mat1.topLeftCorner(3, 3).transpose() * mat2 // PROBLEM LINE

0 个答案:

没有答案