Errors saying "Unable to rename tmp files" when creating/compiling new c++ class

Trying to create a new c++ class and comes up with the errors:

“ERROR: Unable to rename C:\Users\username\Documents\foldername\projectname\Intermediate\Build\Win64\UE4Editor\Development\projectname\projectname.cpp.txt.tmp to C:\Users\username\Documents\foldername\projectname\Intermediate\Build\Win64\UE4Editor\Development\projectname\projectname.cpp.txt”

and that is repeated for files names called:
projectnameGameModeBase.cpp
projectname.init.gen.cpp
projectnameGameModeBase.gen.cpp

I’ve tried looking into the following solutions I’ve seen:

  • delete the tmp files (doesn’t work as they just come back)
  • look into permissions (not the issue)
  • Changed antivirus to accept ue4 (not worked)
  • Turn off anitvirus (not worked)

Any ideas?