我正在尝试导入我编写的.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:
        //...
};

最佳答案

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

关于c++ - “error: redefinition of class”,在同一行上,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39823162/

10-11 22:07
查看更多