I googled a couple of things and i found out that i don't have g++ installed even if i had the following c compliers (gcc,c,c++).
To fix this i installed g++ complier on my ubuntu machine using
apt-get install g++
On RedHat and CentOS it will be
yum install g++