Error when compiling: multiple definition

Strong no.

You want to share a global variable (fsm) accross multiple files, but you’re doing it wrongly and end up defining (=creating) that global variable in every single file that does a #include "main.h". Only one file can create a global variable under a certain name, the others need to just get the declaration.

This has been discussed multiple times in Multiple definitions of... error | first defined here... Build Failure.

The solution is to use to

extern SimpleFSM fsm;

in the main.h file and the addition of

SimpleFSM fsm;

in main.cpp after all headers are included.