如何在 Visual Studio 中强制输出构建错误的绝对路径

Sir*_*tor 2 c++ build vcbuild visual-studio-2008

在大多数 Visual Studio(2008,但我怀疑它很重要)项目中构建时,如果出现错误,它会列出有错误的文件的绝对路径。像这样(忽略具体错误——我故意添加的):

1>dope_external.cpp
1>c:\users\me\dope_external.cpp(4) : error C2144: syntax error : 'void' should be preceded by ';'
1>c:\users\me\dope_external.cpp(4) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>Generating Code...
Run Code Online (Sandbox Code Playgroud)

但是,我当前正在使用的解决方案/项目列出了相对路径名称:

1>FileBasedEffect.cpp
1>..\..\..\..\..\..\..\..\tools\blah\code\src\important_file.cpp(10) : error C2653: 'FusionEffectKeys' : is not a class or namespace name
1>..\..\..\..\..\..\..\..\tools\blah\code\src\important_file.cpp(10) : error C2143: syntax error : missing ';' before 'const'
1>..\..\..\..\..\..\..\..\tools\blah\code\src\important_file.cpp(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Run Code Online (Sandbox Code Playgroud)

这种情况发生在 Visual Studio 中,如果我从命令行或使用 vcbuild 在其他环境中构建,也会发生这种情况。我想使用不同的环境来构建,至少作为实验。但相对路径让我有点困惑。

我没有发现项目属性中有任何明显的差异,例如“UseRelativePathsInBuildErrors”,但我不太了解构建系统。有任何想法吗?谢谢。

Sir*_*tor 5

我找到了解决方案。

在项目属性->配置属性->c/c++->高级中,有一个“使用完整路径”选项,它似乎使 vcbuild 将/FC标志传递给 cl.exe。这会在输出中生成完整路径。

这样就解决了我的问题...但是在我已经看到完整路径的情况下没有设置该选项,所以这里还有其他东西在起作用。