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.
- It can be installed easily:
$ sudo apt install colorgcc
This installs a Perl script at
- Create symbolic links in a directory that is in your
PATHfor each of the compilers you use. For example:
$ ln -s /usr/bin/c++ /home/joe/color-c++
- Now you can invoke Make like this:
$ make CXX=color-c++
Note that the above trick will not work if your Makefile was generated by CMake.
- To ask CMake to use colorgcc, set the
CMAKE_CXX_COMPILERto the path of the symbolic link:
Tried with: ColorGCC 1.3.2 and Ubuntu 16.04