I am having trouble with accessing an enum defining the state of a program between multiple source files.
I define my enum in my header main.h
typedef enum{
STATE_HOME,
STATE_SETUP,
}STATE;
extern enum STATE state;
I declare it in my main.c
#include "main.h"
STATE state = STATE_HOME;
but when I try and use it in another source file, example.c, it says 'undefined reference to state':
#include "main.h"
void loop ()
{
UART(state);
}
extern enum STATE state;
->extern STATE state;
– 0___________extern STATE state;
works fine indeed. – Jean-François Fabre