【问题标题】:Executable not rebuilt but object files recompiled可执行文件未重建,但目标文件已重新编译
【发布时间】:2012-08-29 16:13:02
【问题描述】:

使用 Visual Studio 2012 构建一个基本的 C++ 项目。当我对源文件进行更改时:

  • 编译对应的目标文件
  • 编译器的 .tlog 文件已更新
  • PDB 文件已更新
  • 链接器的 .tlog 文件没有改变
  • 链接器声明 All outputs are up-to-date. 并且不构建新的可执行文件。

获取要构建的可执行文件的唯一方法是删除它。跟踪系统似乎有问题,我想知道是否有人可以对这个问题有所了解。

这是我更改两个文件后的 msbuild 输出,完整路径和一些其他内容被省略(此输出适用于 VS2010 工具集,但 2012 的行为相同):

 1>Target "ClCompile" in file "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.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.0\VC\bin\CL.exe ....
    Tracking command:
    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\Tracker.exe ....
    xxx.cpp
    yyy.cpp
  Done executing task "CL".
1>Done building target "ClCompile" in project "xxx.vcxproj".

到目前为止,一切都很好。现在链接器开始了(好吧,它没有):

1>Target "Link" in file "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.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".

【问题讨论】:

  • 有趣的是,我也有同样的问题,但解决方案对我不起作用。
  • 您的中间/输出目录设置为什么?
  • $(IntDir) 是 $(VmRoot)Temp\$(ProjectName)\$(Platform)\$(Configuration)\,其中 $(VmRoot) 是开发环境的根,$ (VmRoot)Temp 不等于 %TMP% 或 %TEMP%。我目前正在测试该限制也适用于名为“Temp”的 all 目录的子目录的假设。
  • 好点,也许它只是小写(“temp”)的字符串匹配。

标签: visual-studio-2010 visual-studio visual-studio-2012


【解决方案1】:

在逐一检查属性表中的所有选项后,似乎这个问题的唯一来源是我们将中间目录设置为另一个驱动器上的目录。我们总是在 %TEMP% 中进行非源代码构建,并且大多数时候项目驻留在另一个驱动器上。

提交了错误报告here,包括重现问题的简单步骤。希望这很快得到解决。当前的解决方案是将 IntDir 设置为与项目位于同一驱动器上的目录。

更新

针对此问题提交的错误报告已按“设计”关闭:看起来中间目录不应该是 %TEMP% 或 %TMP% 或它们的任何子目录。令人不安,但至少我现在知道出了什么问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-08
    • 2018-10-02
    • 2013-09-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多