Long long time ago, the Arduino IDE did not work with online drives and had trouble with a project divided over different drives. It is possible that your OneDrive settings causes the trouble.
I don't know what else it could be. It compiles on my computer.