If you are running Kubuntu, do in a consle as root,
Code:
#apt-get update
#apt-get install gcc
gcc will be installed and all dependencies automatically resolved. To install g++ (the c++) compiler, you would use either gcc-c++ or just g++ (I am not sure which one exactly).