在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)
我没有把它包括两次,也找不到任何有问题的东西.
归档时间: |
|
查看次数: |
377 次 |
最近记录: |