gpt4 book ai didi

c++ - “error: redefinition of class”,在同一行上

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:45:22 26 4
gpt4 key购买 nike

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com