改善 g++ 输出

Improving g++ output(改善 g++ 输出)
本文介绍了改善 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?

在这里问这个问题可能听起来很傻,但我无法通过谷歌搜索.

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++ 输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Rising edge interrupt triggering multiple times on STM32 Nucleo(在STM32 Nucleo上多次触发上升沿中断)
How to use va_list correctly in a sequence of wrapper functions calls?(如何在一系列包装函数调用中正确使用 va_list?)
OpenGL Perspective Projection Clipping Polygon with Vertex Outside Frustum = Wrong texture mapping?(OpenGL透视投影裁剪多边形,顶点在视锥外=错误的纹理映射?)
How does one properly deserialize a byte array back into an object in C++?(如何正确地将字节数组反序列化回 C++ 中的对象?)
What free tiniest flash file system could you advice for embedded system?(您可以为嵌入式系统推荐什么免费的最小闪存文件系统?)
Volatile member variables vs. volatile object?(易失性成员变量与易失性对象?)