“错误:重新定义类”,在同一行

时间:2016-10-03 00:38:33

标签: c++

我正在尝试导入我写的.h文件,但是我收到以下错误:

$ g++ HeartRate.cpp
In file included from HeartRate.cpp:3:
In file included from ./HeartRate.h:2:
./Date.h:4:7: error: redefinition of 'Date'
class Date {
      ^
./Date.h:4:7: note: previous definition is here
class Date {
      ^
1 error generated.

这是我要导入的文件:

#include <iostream>
#include <string>

class Date {
    private:
        //...
    public:
        //...
};

1 个答案:

答案 0 :(得分:0)

在评论中回答问题。应该关闭