Arduino vs One Drive
/Some things you just have to learn the hard way. For a while I've been frustrated by the way that my Arduino projects would build fine for a while, and then fail after I had saved them.
Eventually I worked out that if you're working on a folder which is being shared by One Drive (or DropBox and probably Google Drive) this causes the Adruino SDK to get upset when it tries to build a solution. This must be due to the file sync process causing files to be locked when they shouldn't be. Move the files to your desktop and the program builds perfectly.
Of course, the proper way to share a development project between a bunch of machines is to use GitHub, and that's what I'll be doing in the future....