GCC 4.9 and later versions have built-in support for color in its output. For more info about using this, see this post. If you are using older versions of GCC, then an option to colorize gcc output is colorgcc.
$ sudo apt install colorgcc
This installs a Perl script at
PATHfor each of the compilers you use. For example:
$ ln -s /usr/bin/c++ /home/joe/color-c++
$ make CXX=color-c++
Note that the above trick will not work if your Makefile was generated by CMake.
CMAKE_CXX_COMPILERto the path of the symbolic link:
Tried with: ColorGCC 1.3.2 and Ubuntu 16.04