Modifying a .cpp file, resulting in Visual Studio 2012 recompiling unrelated files

Curious if anyone knows how to fix this problem; I have a special .cpp file, which for some reason, when I change it (even just adding a space character) and creating a project, causes a number of other unrelated .cpp files to be recompiled (10-20 of them).

This file does not contain # include'd in any other files (I never # include.cpp files directly, only .h), and there are no other dependencies that I can think of - it seems to me that Visual Studio is a misunderstanding of the dependency tree or has some corrupt internal state associated with its assembly process. I tried to delete the directories .sdf, .suo, ipch / ,. user and object files, but the problem appears again after a short time.

Changing any other .cpp file will only recompile this file, as expected.

I am a little versed in MSBuild, but I don’t see anything in the .vxproj file explicitly. As a .cpp file, the question appears only once in the ClCompile element group, and its title appears only once in the ClInclude group.

If it rings for any calls, or if anyone has any tips on how I can track this and fix it, that would be appreciated!

UPDATE:

I ran msbuild /verbosity:Detailed, but, unfortunately, his explanation of why compiled unrelated files were compiled also looks opaque:

Using "CL" task from assembly "Microsoft.Build.CppTasks.Common.v110, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "CL"
Read Tracking Logs:
    Debug\cl.read.1.tlog
Output details (109 of them) were not logged for performance reasons.
{UnrelatedFile1.cpp} will be compiled as {PROBLEM_FILE.CPP} was modified at 4/30/2013 3:28:02 PM.
{UnrelatedFile2.cpp} will be compiled as {PROBLEM_FILE.CPP} was modified at 4/30/2013 3:28:02 PM.
(etc...)

If this makes sense to anyone, let me know you don’t seem to find much information about the internal workings of the CL task or why it will see the dependency between these unrelated CPP files.

+5
source share
2 answers

This is probably because:

  • part of another translational unit.
  • other projects link to file (s).
  • - (, ) "" , , .

: * , , .

, msbuild:

http://blogs.msdn.com/b/msbuild/archive/2005/09/29/475157.aspx

http://msdn.microsoft.com/en-us/library/vstudio/ms164311.aspx

:

msbuild /verbosity:Detailed

msbuild , .

Edit:

: , , /SHOWINCLUDES:

http://msdn.microsoft.com/en-us/library/hdkef6tk(v=vs.80).aspx

, - , ? , , - : .

+1
0

All Articles