Thank you for the replies.
None of my project files are still open in Task Manager, so we can rule that one out, and the only anti-virus software I have (and this may sound a bit dodgy...) is the free version of Malwarebytes, which doesn't do real-time protection, so we can rule that out as well. I have added the folder where the projects are saved to the exclusion list on both Malwarebytes and the Windows Defender app though just to make sure.
All may not seem totally lost however, as I believe I have found the cause of the problem! As I've no common sense, I sometimes save two source code files that both include main() function tags to the same project, which means the build ends in 'complete failure'. It is deleting one of the files and then attempting to build the project again that causes the problem to appear, and the message 'Unable to execute project.exe. Invalid or unsupported executable format.' comes up, and no .exe file is present in the folder. So I guess the lesson here is that I just need to be careful with my saving!