我有两个班在2个不同的文件:“缺少类型说明” 错误
RegMatrix.h:
#ifndef _RM_H
#define _RM_H
#include "SparseMatrix.h"
...
class RegMatrix{
...
RegMatrix(const SparseMatrix &s){...} //ctor
...
};
#endif
SparseMatrix.h:
#ifndef _SM_H
#define _SM_H
#include "RegMatrix.h"
...
class SparseMatrix{
...
SparseMatrix(const RegMatrix &r){...} //ctor
...
};
#endif
在构造函数行我得到的错误:
错误C4430:缺少类型说明符 - int假定。
错误C2143:语法错误:之前 '&' 失踪 ''
但是,当我添加了类声明
class SparseMatrix;
在RegMatrix.h文件和
class RegMatrix;
在SparseMatrix.h文件中它工作正常。 我的问题是为什么它需要,如果我有包括? 10x。
标识符_RM_H和_SM_H是[保留](http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-ac-identifier ),请勿使用它们。 – GManNickG 2010-09-27 18:15:07