所以我试图做一个类,基本上充当与特征矩阵分区的接口,以及一些额外的功能。我的数据结构的一个基本副本是:在编译时的特征断言错误,不清楚的错误
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)
reffers在我的代码行inline typename RMatrix::RowXpr getSample(const int row) { return dataMatrix.row(row) }
。我之前已经能够在我的代码的其他部分获得这项工作,所以我的想法是这是一个叫它的东西。然而,在我称之为的这段时间里,没有[]的使用或不正确的使用RowXpr.
我有很多代码需要通过,所以我不确定如何找到这个错误并且可以使用关于可能出错的一些想法或者我可以如何寻找导致错误的原因。
您是否看到错误消息的“THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD”部分?另外我会看看'XprHelper.h'的第365行。 –
是的,我看过那部分。这就是为什么我通过我的代码搜索寻找[]运算符的用法应用于我的函数构造的任何向量。 – mculp