GCC 输出 MSVC 风格错误

发布于 2024-12-28 20:38:21 字数 462 浏览 1 评论 0原文

是否有一个编译器标志会导致 MSVC 风格的 GCC 输出错误?

GCC 样式错误:

C:\Sandbox\MyFile.cpp:98:15: error: ...

MSVC 样式错误:

C:\Sandbox\MyFile.cpp(15): error CXXXX: ...

我不关心错误号 (CXXXX) 是否相同,只要行号采用 (##): 格式,没有字符号。我想要这个的原因是我正在使用 Visual Studio 启动 Scons GCC 构建,而且我喜欢它在 Visual Studio 的输出控制台中输出错误,但是,当我双击错误时,它只会将我带到文件,但不是发生错误的行(因此它需要采用 MSVC 格式)。

我总是可以重定向 Scons 的输出,自己解析它并更改任何错误,但如果它像设置 GCC 标志一样简单,我想避免这种情况。

Is there a compiler flag that makes GCC output errors in MSVC style?

GCC Style Error:

C:\Sandbox\MyFile.cpp:98:15: error: ...

MSVC Style Error:

C:\Sandbox\MyFile.cpp(15): error CXXXX: ...

I don't care about the error numbers (CXXXX) being the same, so much as the line number being in the format of (##):, without the character number. The reason I want this is that I'm using Visual Studio to launch a Scons GCC build, and I love the fact that it outputs the errors in Visual Studio's Output console, however, when I double click the error it only takes me to the file, but not the line that the error occurred (hence it needs to be in the MSVC format).

I could always redirect the output from Scons, parse it myself and change any errors, but I'd like to avoid that if it's as simple as setting a GCC flag.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明月夜 2025-01-04 20:38:21

我很确定没有办法说服 GCC 假装它的错误消息来自 MSVC。您可能需要创建一个小过滤器脚本或程序,仅删除不需要的字符偏移并将其包装在您的 Scons 构建中。或者使用可以处理两种输出风格的不同 IDE/编辑器。

I'm pretty sure there isn't a way to convince GCC to pretend its error messages are coming from MSVC. You'd probably have to create a little filter script or program that just removes the unwanted character offsets and wrap that around your Scons build. Or use a different IDE/Editor that can handle both styles of output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文