"Cannot open source file" for file that shouldn't be built

The other day I created a local copy of a .cpp file in order to have a temporary backup when fiddling with SVN. The issue was resolved and I kept working and forgot about the local copy.

Today, the copy of the cpp file was suddenly included in the build, and since it was out of date it naturally caused some build errors. I realized that the errors were in the temporary copy of a .cpp file which shouldn’t even be there so I removed the duplicate .cpp file and tried again.

But now the error I get is “Cannot open source file” for the file that I just removed, which wasn’t supposed to be there or be included in the project to begin with!

I’ve tried re-generating project files, didn’t help…

Nevermind, after running a full clean on all configurations in Visual Studio and then rebuilding, the error magically went away.