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++ 输出
基础教程推荐
- 如何在 C++ 中处理或避免堆栈溢出 2022-01-01
- 运算符重载的基本规则和习语是什么? 2022-10-31
- 什么是T&&(双与号)在 C++11 中是什么意思? 2022-11-04
- 您如何将 CreateThread 用于属于类成员的函数? 2021-01-01
- C++,'if' 表达式中的变量声明 2021-01-01
- C++ 程序在执行 std::string 分配时总是崩溃 2022-01-01
- 如何定义双括号/双迭代器运算符,类似于向量的向量? 2022-01-01
- C++ 标准:取消引用 NULL 指针以获取引用? 2021-01-01
- 调用std::Package_TASK::Get_Future()时可能出现争用情况 2022-12-17
- 设计字符串本地化的最佳方法 2022-01-01