Beginner: code works in arduino IDE, but not in platformio?

A more detailed explanation here

It seems that ArduinoIDE is doing a lot of work backstage to be as mush “easy-to-use” as possible, like doing forward declarations by itself ^^