は、私はちょうど>ヘッダ・ファイルにそれを宣言しませんでした:(エラー:あなたは私のパブリッククラス変数はスコープで宣言されていなかった意味は何current_millis 'はこのスコープで宣言されていない
IDEのArduinoの1.6.12 のArduinoをタイプ宇野は、これは問題でちょうどそれがそこ
timelyCall.cpp
#include "Arduino.h"
#include "timelyCall.h"
timelyCall::timelyCall() {
current_millis = millis();
}
timelyCall::~timelyCall() {
ことを確認する必要はありませんここで/
delete current_millis;
}
void timelyCall::callEvery(void (&f)(), int ms) {
if (millis() - current_millis > ms) {
f();
current_millis = millis();
}
}
void setCurrentMillis() {
current_millis = millis();
}
エラーtimelyCall.h
class timelyCall {
public:
timelyCall();
~timelyCall();
unsigned long current_millis;
void callEvery(void (&f)(), int ms);
};
FullError
Arduino: 1.6.12 (Windows 7), Board: "Arduino/Genuino Uno"
sketch\timelyCall.cpp: In destructor 'timelyCall::~timelyCall()':
timelyCall.cpp:8: error: type 'long unsigned int' argument given to 'delete', expected pointer
delete current_millis;
^
sketch\timelyCall.cpp: In function 'void setCurrentMillis()':
timelyCall.cpp:19: error: 'current_millis' was not declared in this scope
current_millis = millis();
^
exit status 1
type 'long unsigned int' argument given to 'delete', expected pointer
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
あなたは 'new'を'削除 'してください(そして 'delete []'は 'new []'とします)。 'new'を使って何かを動的に割り当てていない場合、それを' delete'してはいけません。 –