I'd first check if i have gcc installed or not. You can do this so:
If you have gcc, then whereis will return the absolute path to it. If you have gcc, then go to ~/ and open .bash_profile. Add this line to the file:
when you finish run this command:
Next log in as root and make the same changes. If you have gcc installed, you will probably now be able to upgrade to ver 4.0
But if you haven't no gcc on your machine, then i hardly imagine you will be able to compile anything, since gcc is the compiler, this means nothing can be installed from source on your machine. You can find rpm package of gcc and try to install it or you will have to reinstall linux together with gcc.