Behold this insanity:
enum WhatArduinoIs {
Easy, But, Insane, Obsolete, And, Far, Worse, Than, mBed
};
void TellMe(WhatArduinoIs pls) { }
void setup() { }
void loop() { }
I'm pretty good at C++, so I'm fairly sure that should compile. However I get this error:
sketch_jan21b.ino:3:13: error: variable or field 'TellMe' declared void
sketch_jan21b.ino:3:13: error: 'WhatArduinoIs' was not declared in this scope
Error compiling.
I've encountered the Arduino "IDE"'s propensity for insane and totally unrobust modification of programs before. Specifically when you #include
libraries Arduino only magically adds the relevant C++ files if the #include
is in your main sketch. #include <LiquidCrystal.h>
in another C++ file? Link errors.
I suspect in this case it is Arduino magically trying to add function declarations to the start of the file so their order doesn't matter. I.e. it turns the file into this:
void TellMe(WhatArduinoIs pls);
enum WhatArduinoIs {
Easy, But, Insane, Obsolete, And, Far, Worse, Than, mBed
};
void TellMe(WhatArduinoIs pls) { }
void setup() { }
void loop() { }
That obviously doesn't work. How can I tell Arduino to leave my damn program alone?