在大多数 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...
但是,我目前正在使用的解决方案/项目列出了相对路径名:
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
这发生在 Visual Studio 中,如果我从命令行或使用 vcbuild 在另一个环境中构建,也会发生这种情况。我想使用不同的环境来构建,至少作为一个实验。但是相对路径让我有点害怕。
我没有发现项目属性中有任何明显的差异,例如“UseRelativePathsInBuildErrors”,但我不太了解构建系统。有任何想法吗?谢谢。