I had this problem when migrated to the new PC where I decided to keep all my stuff on the Google Drive. So I built successfully the debug version. But when tried to build the Release, all of a sudden had this error:
1>g:\my drive\...\proj_globals.cpp : fatal error C1083: Cannot open compiler intermediate file: 'G:\My Drive\...\bin\Release\Win32\myProject.ipdb': Permission denied
1>LINK : fatal error LNK1257: code generation failed
1>Done building project "myProject.vcxproj" -- FAILED.
I found out that even though my D drive is NTFS, Google Drive File Stream (G:) was FAT32. Seems that this caused weird behavior with the .ipdb file access.
I managed to bypass the problem by changing the output directory in Visual Studio Configuration Properties->General->Output Directory to other, non GoogleDrive, NTFS location.