可执行文件未重建,但目标文件已重新编译 [英] Executable not rebuilt but object files recompiled
问题描述
使用Visual Studio 2012构建基本的C ++项目.当我对源文件进行更改时:
Building a basic C++ project with Visual Studio 2012. When I make changes to source files:
- 已编译相应的目标文件
- 用于编译器的.tlog文件已更新
- PDB文件已更新
- 链接器的.tlog文件未更改
- 链接器声明为
All outputs are up-to-date.
,并且不会生成新的可执行文件.
- 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.
这里是我更改两个文件,完整路径和其他一些内容后的msbuild输出(此输出用于VS2010工具集,但2012的行为相同):
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)\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".
到目前为止,太好了.现在链接器启动了(嗯,没有):
so far, so good. Now the linker kicks in (well, it doesn't):
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".
推荐答案
在逐一检查属性表中的所有选项后,看来此问题的唯一来源是我们将中间目录设置为另一个驱动器上的目录.我们通常会在%TEMP%中进行源代码构建,大多数情况下,这些项目都位于另一个驱动器上.
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.
提交了错误报告此处,其中包含重现该问题的简单步骤.希望此问题能尽快解决.当前的解决方案是将IntDir设置为与项目在同一驱动器上的目录.
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.
更新
针对此问题提交的错误报告已按设计"关闭:似乎中间目录不应为%TEMP%或%TMP%或其中的任何子目录.令人不安,但至少我现在知道出了什么问题.
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.
这篇关于可执行文件未重建,但目标文件已重新编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!