Error when building: -waitmutex" exited with code 5 . Please verify that you have sufficient rights to run this command

Hi - not sure if this will help, but I had the same error, with additional errors saying that VS17 cannot get access to certain files. I use Perforce, so I unlocked everything - still no joy. I then went to the file it said it cannot access and Unlocked it (Right-Click file, and uncheck ReadOnly). Still no joy. I then went to the Root folder (the project name folder) and Unchecked -Only, and selected to Uncheck all children folders and files. It worked after that. Not sure why but it seems to be ok now.

If this is a bad way, or just crappy way to fix it, then I would love to hear the correct way to fix it.
Thanks