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


基础教程推荐
- 这个宏可以转换成函数吗? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 常量变量在标题中不起作用 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 在 C++ 中计算滚动/移动平均值 2021-01-01