Simple Macro program I think

Uh wow. Pretty old. This version makes your computer vulnerable through the log4j-java security-gap

I highly recommend that you update to version 1.8.19

There is a possability to have a completely independant second Arduino IDE as a portable version

For an Arduino Mega it should compile immidiately after installing
You will have to install the ESP8266 package for ESP8266 support.

Anyway maybe the reason might be the super old Arduino IDE and or an old ESP8266 package.

What is so hard about following the compiler-log tutorial and then posting the complete compiler-log?

There is no way around posting this verbose compiler-log !

I have taken your code from post # 26 and pasted into a WOKWI-Demo that compiles just fine.

So without a much more detailed information about YOUR computers configuration which will be delivered by the verbose compiler-log
we can't help you !