colorgcc – Color your compiler output on Fedora

2012-07-11 366 words 2 mins read

Lets start with installing colorgcc :

sudo yum install colorgcc

Now once that is done, you will need to ensure that the call to g++, gcc and others that you want to use, you will need to create a link in the “~/bin” directory, like so:

for i in g++ gcc c++ cc 
do
    ln -s $(which colorgcc) ~/bin/$i
done

The one liner above will create the links for colorgcc as **** your favourite compiler in your homedir. Don’t forget to add the bin diretory to your PATH variable:

export PATH=~/bin:$PATH

And now finally the ~/.colorgccrc file taken from Ubuntu for your reference:

#
# colorgcc configuration file
#
# $Id: colorgccrc,v 1.1.1.1 1999/04/25 15:24:03 jamoyers Exp $
#
# This file should be named $HOME/.colorgccrc
#
#
# The following groups of attributes may be combined for a given color:
#
# clear         black      on_black
# reset            red        on_red
# bold            green      on_green
# underline     yellow     on_yellow
# underscore    blue       on_blue
# blink            magenta    on_magenta
# reverse       cyan       on_cyan
# concealed     white      on_white
#
# For example, srcColor: bold cyan on_yellow
#

# gccVersion: if defined, append "-" to the compiler paths
# defined hereunder. Otherwise, those paths remains as is set
# gccVersion: 4.1.1

# Define the paths to the actual location of the various compilers.
# (Currently, colorgcc only understands these: g++ gcc c++ cc g77 f77 gcj)
g++: /usr/bin/g++
gcc: /usr/bin/gcc
c++: /usr/bin/g++
cc:  /usr/bin/gcc
#g77: /usr/bin/g77
#f77: /usr/bin/g77
#gcj: /usr/bin/gcj

# Don't do color if our terminal type ($TERM) is one of these.
# (List all terminal types on one line, seperated by whitespace.)
nocolor: dumb emacs

# Text between ` and ' is usually source code.
srcColor: bold cyan

# Text other than a warning or error.
introColor: reset

# Warnings and errors both have similar formats:
#    filename:999:Message
# Each field may be assigned a different color.

# Warnings
warningFileNameColor: reset
warningNumberColor:   blue
warningMessageColor:  yellow

# Errors
errorFileNameColor: reset
errorNumberColor:   blue
errorMessageColor:  bold red

# Possible translations, if you use localized compiler.
# (List all translations on one line, seperated by whitespace.)
warningTranslations:
errorTranslations:
Enhanced by Zemanta

author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it