mfc中在view.cpp中声明一个函数,再在view.中添加声明,.cpp中报错声明不兼容
//view.cpp中:
void C实验二View::matrix3x3multiply(Matrix3x3 m1, Matrix3x3 m2)
{
int row, col;
Matrix3x3 mattemp;
for (row = 0; row < 3; row++)
for (col = 0; col < 3; col++)
mattemp[row][col] = m1[row][0] * m2[0][col] + m1[row][1] * m2[1][col] + m1[row][2] * m2[2][col];
for (row = 0; row < 3; row++)
for (col = 0; col < 3; col++)
m2[row][col] = mattemp[row][col];
}
void C实验二View::Matrix3x3setidentity(Matrix3x3 matident3x3)
{
int row, col;
for (row = 0; row < 3; row++)
for (col = 0; col < 3; col++)
matident3x3[row][col] = (row == col);
}
//view中
virtual void C实验二View::matrix3x3multiply(Matrix3x3 m1, Matrix3x3 m2);
virtual void C实验二View::Matrix3x3setidentity(Matrix3x3 matident3x3);
查了一下有人说是因为头文件反复包含,我看了一下,我好像没有反复包含
cpp中包含.h都只有一个
求解答 很疑惑
view.h中
virtual void matrix3x3multiply(Matrix3x3 m1, Matrix3x3 m2);
virtual void Matrix3x3setidentity(Matrix3x3 matident3x3);
报错是指m1,m2,matident3x3的参数类型错误,
Matrix3x3 m1, Matrix3x3 m2
Matrix3x3 matident3x3
声明和定义类型是一致的吗?