How to get color output from GCC

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s