I made a new Arduino IDE project ABC, and am given ABC.ino. Then I create a XYZ.h and XYZ.cpp.
ABC.ino:
#include "XYZ.h"
void setup() {}
void loop() {}
XYZ.h:
#ifndef XYZ
#define XYZ
#include "Arduino.h"
class XYZ { };
#endif
XYZ.cpp:
#include "Arduino.h"
#include "XYZ.h"
When I try to compile this, I get some error:
In file included from sketch/XYZ.cpp:2:0:
XYZ:8: error: abstract declarator '<anonymous class>' used as declaration
};
^
exit status 1
abstract declarator '<anonymous class>' used as declaration
However, when I rename my class to something other than the file name, like XYZa, the compilation succeeds.
Why can't I have the same name class as the file?
I've done C++ projects (independent of Arduino) via Xcode and nano, and this has never been a problem.