提高g ++输出 [英] Improving g++ output

查看:76
本文介绍了提高g ++输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

g ++有时会产生漂亮的回旋输出。特别在处理模板时。有没有任何工具,使g ++输出更可读? ...至少有一些颜色?

g++ sometimes produces pretty convoluted outputs. Specially when dealing with templates. Is there any tool that makes g++ output more readable? ... at least some color?

在这里问这个问题可能听起来很蠢,但是我已经无法用google来解决这个问题了。

It may sound silly to ask this question here, but I've been unable to google my way out of this.

推荐答案

如果您可以自由切换编译器,请尝试 clang ++ 。它的错误输出是大多数时候非常清楚,有时甚至会告诉你该怎么做,以解决您的错误。您可以在此处找到gcc和clang错误输出的比较: http://clang.llvm.org/diagnostics.html

If you're free to switch compiler, try clang++. It's error outputs are most of the time very clear and sometimes it will even tell you what to do to fix your error. You can find a comparison of gcc vs clang error output here: http://clang.llvm.org/diagnostics.html.

否则,如Matteo Italia所述,请查看 STLFilt

Otherwise, as noted by Matteo Italia, look to STLFilt.

对于颜色方面,Edwin Buck的解决方案( colorgcc )非常好。你可以创建一个名为gcc,g ++等的符号链接,以便在你运行编译器命令时使用它(前提是你正确地设置了colorgcc脚本中的路径)。我发现这在从一个Makefile编译一些大项目时特别方便。帮助极大地检测到哪里出错了(特别是当你使用 make -j 进行并行编译时)。

For the color aspect, Edwin Buck's solution (colorgcc) is very good. You can create symlinks to it named gcc, g++, etc so that it always gets used whenever you run a compiler command (provided you setup the paths in the colorgcc script correctly). I find this especially convenient when compiling some large project from a Makefile. Helps tremendously to detect where exactly something went wrong (especially when you do parallel compilations with make -j).

这篇关于提高g ++输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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