Tuesday, March 1, 2011

Is there any way to get readable gcc error and warning output at the command line?

For some long errors, the gcc output is dense and has lots of line-wrapping etc. Especially when errors are subtle, it can take me 10-30 seconds of squinting to parse it with my eyes.

I've taken to pasting this in an open code-editor window to get some basic syntax highlighting and enable reformatting with regex's.

Has anyone invented a more automated method?

From stackoverflow
  • If your errors are template related, take a look at STLfilt:

    mikeh : Michael, same story as comment to Mr. Fooz's answer above. Your answer was first and it was dead-on -- those template errors are exactly what inspired my post. I'll be using STLfilt from tomorrow until I die. BTW I voted both of you up using my new, functional account. Thanks again.
    Michael Burr : FWIW, I find that there's no need for something like STLfilt with MS's newer compilers - they give quite readable error messages right out of the box now.
  • I've found colorgcc to be invaluable. By introducing coloring, it becomes much easier to mentally parse the text of gcc error messages, especially when templates are involved.

    mikeh : Hey, I posted that with a temp account and now I can't follow up with it, but I wanted to say thanks for this -- that is an awesome utility and just the sort I was looking for.
    Mr Fooz : Glad to be of service.
  • gccfilter does coloring & simplification of messages.

    http://www.mixtion.org/gccfilter/

0 comments:

Post a Comment