Improving g++ output

GCC as of 4.9 has colourized output ☺

Append the following to your bashrc/zshrc/whatever.

export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

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.

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

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).


There's colorgcc, a perl script which wraps the gcc (g++) output with color for easier readability.

As far as the "output" of gcc (g++) I am guessing you're not complaining about the compiled binaries :)