Error during compiling with typedef

Hello everyone,

I'm currently building a dashboard for Simracing Rigs with the help of some online source code and adjusting/adding more functions to my liking.
Now an issue came up when I switched from an Arduino Uno to a Micro Pro.

typedef enum {
  RPM,
  RPM_TICK,
  SPEED,
  GEAR,
  TYRE_STATUS,
  TYRE_TEMP,
  TIME,
  INIT,
  FUEL,
  LAP,
  CURRENT_TIME,
  FUEL_TICK,
  CURRENT_POSITION,
  PERFORMANCE_METER,
} MessageType;

The code above compiles perfectly fine on the Uno and also works in conjunction with the rest.
However, since I try to move the project to the smaller Micro Pro, i get these error messages:

  • error: expected identifier before numeric constant
  • SPEED,
  • ^
  • error: expected '}' before numeric constant
  • error: expected unqualified-id before numeric constant
  • error: expected declaration before '}' token
  • } MessageType;
  • ^

Commenting the line "SPEED," resolves the issue, but leads to the problem that I cant use further methods later on in the code, since it wasn't declared above.
Now I'm wondering why this is only happening to the Micro Pro. I couldn't find any sources online relating to a SPEED constant, but maybe someone here knows.

The error also occured when I tried creating a new sketch with nothing but this

typedef enum {
  SPEED,
} MessageType;
void setup() {
  // put your setup code here, to run once:
}
void loop() {
  // put your main code here, to run repeatedly:
}

I didn't try a different Micro Pro yet, but will do so by Tuesday.

Regards.

It seems likely that SPEED is already #defined. As an experiment, take it out of the enum so that you are not defining it and try printing it in setup(). What is printed ?

Thank you for the reply,

it actually prints "3"

So it is already defined somewhere. Just change the name of your version

Thank you for your suggestion, I could verify its working with a different name now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.