Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

highlight and filter (gcc) compiler messages

i'm currently refactoring a C-project, throwing about 1000 warnings at me. is there a way to highlight and filter these warnings. (eg make all index warnings red, unused blue, and some other)

most likely some ides can do that, but that's no solution for me.

like image 946
Dill Avatar asked Dec 02 '22 07:12

Dill


2 Answers

This is really basic, but I've been using grep...

make 2>&1 | grep --color -iP "\^|warning:|error:|"

just to quickly draw the eye to the error line and offending section pointed to by ^.

enter image description here

I've found other methods over-use colour and you end up with the same problem. I guess you could also inject colour escape sequences with sed.

like image 84
jozxyqk Avatar answered Dec 18 '22 19:12

jozxyqk


Try the colorgcc Debian package. There are also three other packages I found: Johannes Schlüter's colorgcc, or this package in German, or this Sourceforge project

like image 34
user9876 Avatar answered Dec 18 '22 20:12

user9876