如何在Visual Studio中为生成错误强制使用绝对路径 [英] How to force absolute paths for build errors output in Visual Studio

查看:63
本文介绍了如何在Visual Studio中为生成错误强制使用绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在大多数Visual Studio(2008,但我怀疑这很重要)项目中进行构建时,如果存在错误,它将列出带有错误的文件的绝对路径.像这样(忽略特定错误-我有意添加了这些错误):

When building in most Visual Studio (2008, but I doubt it matters) projects, if there is error, it lists the absolute path of the file with the error. Like this (ignore the specific errors--I added them intentionally):

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...

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

However, the solutions/projects I'm currently working with list relative path names:

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在另一个环境中进行构建时发生.我想至少在实验中使用不同的环境来构建.但是相对的路径让我有点沮丧.

This happens in Visual Studio and also if I build from the command-line or in another environment using vcbuild. I'd like to use a different environment to build, at least as an experiment. But the relative paths are horking me a little.

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

I don't spot any differences in the project properties that are obvious like "UseRelativePathsInBuildErrors", but I don't know the build system that well. Any ideas? Thanks.

推荐答案

我找到了解决方案.

在项目属性->配置属性-> c/c ++->高级中,有一个使用完整路径"选项似乎使vcbuild通过

In project properties->configuration properties->c/c++->Advanced, there is a "Use Full Paths" option which appears to make vcbuild pass the /FC flag to cl.exe. This produces full paths in output.

这样可以解决我的问题...但是在我已经看到完整路径的情况下,不会设置该选项,因此这里还有其他作用.

so that solves my problem...but that option isn't set in the case where I already see full paths, so there's something else at play here.

这篇关于如何在Visual Studio中为生成错误强制使用绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆