GCC 输出 MSVC 风格错误
是否有一个编译器标志会导致 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很确定没有办法说服 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.