Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to get color output from GCC

📅 2014-Jun-18 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ colorgcc, colors, gcc ⬩ 📚 Archive

If you are using GCC 4.9 and later versions, you can get colorful diagnostics for errors, warnings and notes when you compile C or C++ code. This is not as colorful as ColorGCC, just the words error, warning and note are colored and the location of the error in the source line is indicated in color. In my opinion, even this subtle coloring goes a long way since finding the error message in a wall of error text was my biggest problem with GCC.

To get color diagnostics from GCC:

$ gcc -fdiagnostics-color=auto foo.c

$ g++ -fdiagnostics-color=auto foo.cpp

Tried with: GCC 4.9.0 and Ubuntu 14.04

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