List only files where compilation errors happened

I want a list of files where compilation errors happened without duplicates. Like so:


I’m using Emacs’s compilation mode to run gcc. Is there some way to achieve that either through gcc itself or through Emacs?

Edit: I’m running make with the -k0 option, so the compilation process already keeps going as long as it can. My goal is to create a list of files I need to go through to make some small adjustments so that the compilation succeeds. I already know what the compilation error is (I marked one specific method as [[deprecated]]), so I don’t need any diagnostics.


After looking for some ideas1, here’s what I found works for me:

more compilation-out | grep "error:" | sed 's/:.*//' | sort | uniq

(There are several options to do this on Emacs2).