When I go to debug my C++ project in Visual Studio, up pops a little warning dialogue box that tells me:
A copy of datum.h was found in
c:/users/brad/desktop/sou
Just encountered this. In my case, one of my .h
files contained implementation (a class with static methods), which was #included by one of my .cpp
files, but the Project Settings were also telling Visual Studio to compile the .h
file.
I manually edited both the .vcxproj
and .vcxproj.filters
project files, moving the .h
file from the <ClCompile>
ItemGroup to the <ClInclude>
ItemGroup.
This did the trick for me; I never saw the "A copy of...is different from..." pop-up again.
(Note that this was after I had thoroughly failed in attempts to get <DependentUpon>
to work.)
Could you by any chance be debugging another executable (not the one actually built?). This is a common issue in scenarios where Visual Studio builds the binaries in one directory but then they are copied over to some other directory for debugging. I'd suggest you compare the target path under the debugging settings and the output directory under the general settings in Visual Studio.
This would explain the issue, since you are actually debugging some older version of the binary (not the one built currently) and thus the warning, since Visual Studio can't find the version of the source files for that version of the binary.
this worked for me:
The reason may be circular header dependencies. datum.h may includes another_header.h (directly or indirectly), which includes datum.h.
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.
My solutiion: