Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to colorize gcc output using colorgcc

📅 2017-Oct-02 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ colorgcc, colors, gcc ⬩ 📚 Archive

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 /usr/bin/colorgcc.

$ 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.

set(CMAKE_CXX_COMPILER /home/joe/color-c++)

Tried with: ColorGCC 1.3.2 and Ubuntu 16.04

© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧