Arduino ESP32 "typedef enum" doesn't work?

Hi everyone,
I use an ESP32 with arduino IDE

In my code I have:

typedef enum {
  RETURN_OK       = 0x00,                             
  ERR_WrongParam      = 0x06,                  
}LLD_RETURN_TYPE;

Then I create a new function like:

LLD_RETURN_TYPE MyNewFunction(uint8_t something)  {
//my function 
}

When I compile, I get the ollowing error:
'LLD_RETURN_TYPE' does not name a type

What I can do please ?

Where? And yes, that can be relevant, it needs to be at the top of your code or in a separate file that you include at the top of your code.

Please show ALL your code.

This compiles fine for me:

typedef enum {
  RETURN_OK       = 0x00,                             
  ERR_WrongParam      = 0x06,                  
} LLD_RETURN_TYPE;

LLD_RETURN_TYPE MyNewFunction(uint8_t something)  {
//my function 
}
void setup() {
Serial.begin(9600);
}

void loop() {
 LLD_RETURN_TYPE aa = MyNewFunction(2);
}

Indeed it was not at the top of my code ! It woks now, thanks a lot !!

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