c++ – Visual Studio debugger running old version of code


When I try to modify a specific header file in my code (all other files have no issues when modified), upon building and running (debug or release, doesn’t matter), it seems to run with the old version of the header and prevents use of breakpoints there. (It also informs me that a copy of the offending file was found with different contents).

If I modify the offending file in ways that are syntactically correct, it runs the old version, but if I modify the offending file such that it generates compile-time errors then it simply fails to run after failing to build.

Cleaning the solution and rebuilding makes it work as expected, but only until I modify the file again at which point I have to rebuild the entire solution again, which is not ideal.

I tried deleting all “.vs” folders in my project, but it just had the same effect as rebuilding the solution. Deleting the .pdb/.exe files did nothing, the build output mentions they were missing, relinked them, and had the same issue immediately. I also tried deleting and replacing the file, and even creating a new header with a different name and the same contents and including that instead, but ran into the same issue after modifying it again. Disabling in the debugger options to “Require source files to exactly match” did not help either. There were a few other settings and tricks I tried that I found on here that didn’t work, but I can’t recall them right now.

Any ideas? I’ve tried various solutions listed on this site and have had no success so far. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *