Error compiling of board Arduino/Genuino Mega or Mega 2560

Try restarting the Arduino IDE. It's possible that something got messed up with the cached code and that will clear the cache.