因此,我正在尝试创建一个基本上充当与用于分区的特征矩阵的接口的类,以及一些附加功能。我的数据结构的基本副本是:
template <class T>
class DataFile {
public:
typedef Eigen::Matrix<DataType, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> RMatrix;
DataFile(int inputRows, int inputColumns) {
dataMatrix = RMatrix::Zero(inputRows, inputColumns);
}
inline typename RMatrix::RowXpr getSample(const int row) { return dataMatrix.row(row) }
private:
RMatrix dataMatrix;
这只是简单地看待我所做的以及似乎相关的事情。当我使用 Qtcreator 和 MSVC2008 编译我的代码时,我收到以下错误消息:
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/DenseCoeffsBase.h(390) : error C2039: 'THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD' : is not a member of 'Eigen::internal::static_assertion<condition>'
with
[
condition=false
]
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/DenseCoeffsBase.h(388) : while compiling class template member function 'float &Eigen::DenseCoeffsBase<Derived,Level>::operator [](__int64)'
with
[
Derived=Eigen::Matrix<float,-1,-1,1>,
Level=1
]
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/DenseCoeffsBase.h(653) : see reference to class template instantiation 'Eigen::DenseCoeffsBase<Derived,Level>' being compiled
with
[
Derived=Eigen::Matrix<float,-1,-1,1>,
Level=1
]
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/util/XprHelper.h(365) : see reference to class template instantiation 'Eigen::DenseCoeffsBase<Derived>' being compiled
with
[
Derived=Eigen::Matrix<float,-1,-1,1>
]
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/DenseBase.h(53) : see reference to class template instantiation 'Eigen::internal::special_scalar_op_base<Derived,Scalar,OtherScalar>' being compiled
with
[
Derived=Eigen::Matrix<float,-1,-1,1>,
Scalar=float,
OtherScalar=float
]
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/MatrixBase.h(65) : see reference to class template instantiation 'Eigen::DenseBase<Derived>' being compiled
with
[
Derived=Eigen::Matrix<float,-1,-1,1>
]
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/PlainObjectBase.h(89) : see reference to class template instantiation 'Eigen::MatrixBase<Derived>' being compiled
with
[
Derived=Eigen::Matrix<float,-1,-1,1>
]
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/Matrix.h(144) : see reference to class template instantiation 'Eigen::PlainObjectBase<Derived>' being compiled
with
[
Derived=Eigen::Matrix<float,-1,-1,1>
]
d:\users\public\documents\myCode\DataFilesV2.h(46) : see reference to class template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols,_Options>' being compiled
with
[
_Scalar=float,
_Rows=-1,
_Cols=-1,
_Options=1
]
c:\apis_x64\eigen-eigen-ca142d0540d3\eigen\src/Core/DenseCoeffsBase.h(390) : error C2065: 'THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD' : undeclared identifier
该行d:\users\public\documents\myCode\DataFilesV2.h(46)
指的inline typename RMatrix::RowXpr getSample(const int row) { return dataMatrix.row(row) }
是我的代码中的行。我之前已经能够在我的代码的其他部分完成这项工作,所以我的想法是它正在调用它。但是,在我称之为这个的所有时间里,没有使用 [] 或不当使用RowXpr.
我有很多代码要处理,所以我不确定如何找到这个错误并且可以使用一些关于可能出了什么问题或我如何找出导致错误的原因的想法。