类构造函数声明了两次

Nei*_*kos 0 c++ arduino

在Arduino IDE中,我收到有关如何声明我的构造函数两次的错误.

这是它的代码:

tond.h

#ifndef TOND_H
#define TOND_H

class Tondeuse {

public:
  Tondeuse();
  Tondeuse(int,int);

};

#endif
Run Code Online (Sandbox Code Playgroud)

tond.cpp

#ifndef TOND
#define TOND

#include "arduino.h"
#include "tond.h"


Tondeuse::Tondeuse()
{

}

Tondeuse::Tondeuse(int h, int w)
{

Serial.println("Hello");

}



#endif
Run Code Online (Sandbox Code Playgroud)

而错误:

Tondeuse.cpp.o: In function `Tondeuse':
/tond.cpp:11: multiple definition of `Tondeuse::Tondeuse()'
tond.cpp.o:C:\Users\DEPANNE\AppData\Local      \Temp\build6942484698459603114.tmp/tond.cpp:11: first defined here
Tondeuse.cpp.o: In function `Tondeuse':
/tond.cpp:11: multiple definition of `Tondeuse::Tondeuse()'
tond.cpp.o:C:\Users\DEPANNE\AppData\Local   \Temp\build6942484698459603114.tmp/tond.cpp:11: first defined here
Tondeuse.cpp.o: In function `Tondeuse':
/tond.cpp:16: multiple definition of `Tondeuse::Tondeuse(int, int)'
tond.cpp.o:C:\Users\DEPANNE\AppData\Local\Temp\build6942484698459603114.tmp/tond.cpp:16: first defined here
Tondeuse.cpp.o: In function `Tondeuse':
/tond.cpp:16: multiple definition of `Tondeuse::Tondeuse(int, int)'
tond.cpp.o:C:\Users\DEPANNE\AppData\Local\Temp\build6942484698459603114.tmp/tond.cpp:16: first defined here
Run Code Online (Sandbox Code Playgroud)

我没有把它包括两次,也找不到任何有问题的东西.

Luc*_*ore 5

你加入tond.cppTondeuse.cpp.不包含实现文件.

如果文件不再存在(重构),请确保在再次构建之前清理解决方案.