在 Arduino IDE 中,我收到关于我的构造函数如何声明两次的错误。
这是它的代码:
吨.h
#ifndef TOND_H
#define TOND_H
class Tondeuse {
public:
Tondeuse();
Tondeuse(int,int);
};
#endif
吨.cpp
#ifndef TOND
#define TOND
#include "arduino.h"
#include "tond.h"
Tondeuse::Tondeuse()
{
}
Tondeuse::Tondeuse(int h, int w)
{
Serial.println("Hello");
}
#endif
和错误:
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
我没有将它包含两次,也找不到任何问题。