Visual Studio warning about copies of files with different contents
Solution 1:
Try removing breakpoints from the file in question. This worked for me when it occurred with Visual Studio 2013 for a header file in debug build. Source: Release mode file sync issue - current source code different from the version built
Additional notes: Clean / Rebuild also works, but that is painful for regularly changing code. Enabling the break point after starting debugger merely delays the message.
Solution 2:
I solved it:
- Close the window of the .h file in Visual Studio if it's open.
- Close Visual Studio.
- CUT the .h file from its normal location and paste it into a temporary folder that VS doesn't know about.
- Restart VS and compile. It'll complain about the missing .h file. Good -- Make the bastard beg for it!
- Paste the .h file back into its original location.
- Compile. VS will gratefully accept the missing file. (Damn I hate Microsoft!)
Solution 3:
This occurs if you rename an implementation file (*.c, *.cpp, etc.) to a header file.
This is because the Item Type still remains as C/C++ Source File
, making it get compiled as a separate translation unit rather than as an actual header, preventing Visual Studio from recognizing its inclusion as a header elsewhere.
It took me quite a while to figure this out.
To fix this:
-
Right-click your header file in Solution Explorer and select Properties.
-
Select All Configurations, All Platforms.
-
Under General, change Item Type to
C/C++ Header
. -
Press OK.
-
Force-recompile any file that
#include
s your header (or justRebuild
the solution).
Solution 4:
The problem is that the debugger thinks that the checksum of the source file is different from what the compiler calculated and put in there. The debugger will then refuse to apply breakpoints in the files that mis-match, to prevent you from seeing data it can't guarantee is correct.
I have had this keep happening even after a clean rebuild. This is with VS 2015. My guess is perhaps the debugger and the compiler disagree on how to hash newlines or something like that? The fix is to turn off "require source files to exactly match the original version" in Debug -> Options -> Debugging -> General