Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

visual studio 2010 - Executable not rebuilt but object files recompiled

Building a basic C++ project with Visual Studio 2012. When I make changes to source files:

  • the corresponding object files are compiled
  • the .tlog files for the compiler are updated
  • the PDB file is updated
  • the .tlog files for the linker however are not changed
  • the linker claims All outputs are up-to-date. and does not build a new executable.

The only way to get the executable to be built is deleting it. It seems something with the tracking system is wrong and I was wondering if anyone can shed some light on this issue.

Here is the msbuild output after I change two files, full paths and some other stuff omitted (this output is for the VS2010 toolset, but 2012 behaves the same):

 1>Target "ClCompile" in file "C:Program Files (x86)MSBuildMicrosoft.Cppv4.0PlatformsWin32Microsoft.Cpp.Win32.targets"...
  Using "CL" task from assembly "Microsoft.Build.CppTasks.Win32, Version=4.0.0.0...
  Task "CL"
    Read Tracking Logs:
     cl.read.1.tlog
     CL.2520.read.1.tlog
     ...
    Outputs for ....
     XXX.OBJ
     YYY.OBJ
     ...
    xxx.cpp will be compiled as xxx.cpp was modified...
    yyy.cpp will be compiled as yyy.cpp was modified...
    Write Tracking Logs:
     cl.write.1.tlog
     CL.2520.write.1.tlog
     ...
    C:Program Files (x86)Microsoft Visual Studio 10.0VCinCL.exe ....
    Tracking command:
    C:Program Files (x86)Microsoft SDKsWindowsv8.0AinNETFX 4.0 ToolsTracker.exe ....
    xxx.cpp
    yyy.cpp
  Done executing task "CL".
1>Done building target "ClCompile" in project "xxx.vcxproj".

so far, so good. Now the linker kicks in (well, it doesn't):

1>Target "Link" in file "C:Program Files (x86)MSBuildMicrosoft.Cppv4.0PlatformsWin32Microsoft.Cpp.Win32.targets"....
  Using "Link" task from assembly "Microsoft.Build.CppTasks.Win32, Version=4.0.0.0...
  Task "Link"
    Using cached output dependency table built from:
    link.write.1.tlog
    Using cached input dependency table built from:
     ink.read.1.tlog
    Outputs for ....
     MY.EXE
     MY.PDB
    All outputs are up-to-date.
  Done executing task "Link".
  Task "Message"
    xxx.vcxproj -> my.exe
  Done executing task "Message".
1>Done building target "Link" in project "xxx.vcxproj".
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

After checking all options we have in the property sheets one-by-one, it seems the sole source of this problem is that we have the intermediate directory set to a directory on another drive. We always do out of source builds in %TEMP%, and most of the time the projects reside on another drive.

Filed a bug report here including simple steps that reproduce the problem. Hopefully this gets fixed soon. Current soltuion is to set IntDir to a direcyory on the same drive as the project.

UPDATE

The bug report filed for this issue was closed as 'by design': it seems the Intermediate Directory should not be %TEMP% or %TMP% or any subdirectory of those. Disturbing, but at least I know what was wrong now.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...