What is the output of
? Unless the software you are compiling is very old, you can select the latest version of gcc and let yum take care of all the dependencies.
Also, have you checked for binary packages available for your distribution? There are Red Hat packages at the DAG repository. You need to compile only if you want the latest version.