【发布时间】:2015-10-07 20:31:26
【问题描述】:
我正在尝试使用g++ 编译我的代码,但它抛出了这个编译器错误:
Enrollment.h:3:7: error: redefinition of class sict::Enrollment
Enrollment.h:3:7: error: previous definition of class sict::Enrollment
我的Enrollment.h:
namespace sict{
class Enrollment{
private:
char _name[31];
char _code[11];
int _year;
int _semester;
int _slot;
bool _enrolled;
public:
Enrollment(const char* name , const char* code, int year, int semester , int time );
Enrollment();
void set(const char* , const char* , int ,int, int , bool = false );
void display(bool nameOnly = false)const;
bool valid()const;
void setEmpty();
bool isEnrolled() const;
bool hasConflict(const Enrollment &other) const;
};
}
有什么办法解决这个问题?
【问题讨论】:
标签: c++ class redefinition