Member Avatar



I'm trying to install GCC 4.5.1 on Ubuntu for C++ programming.

So far, I've tried a myriad of different commands in Terminal to try to update GCC (the preinstalled version is 4.3.2), but none of them seem to work. When I go to update my packages with Synaptic Package Manager, it gives me a bunch of errors telling me that it failed to connect to the repository.

Also, I've tried just compiling a C++ file with the preinstalled GCC, and it tells me that cc1plus wasn't found.

Any suggestions?

hi coil,
sudo apt-get install build-essential
which g++
will give you the path to g++ binary. If this doesn't work, try
sudo apt-get install g++

Hope this works[assuming your OS Ubuntu].

Sarma CSMG

What version of Ubuntu are you using? If you're using a version that has 4.3 in the repositories, you will have a very hard time trying to upgrade it to 4.5. It might be easier to install a new version of Ubuntu than it is to upgrade the compiler.

Member Avatar


Thanks for your replies!

I did try running the build-essential commands and trying to directly install g++ with sudo apt-get, but neither of them solved my problem.

Ishara: So if I install version 10, I assume that GCC 4.5 will be installed - are there any other utilities I need to install then for C++ programming, or is that it?

If you install 10.10 and install 'g++' through Synaptic, you should be set up to compile c++ code with no further work. I don't know if the compiler is installed by default, but you should be able to get it through the repository.

Out of curiosity, when you compile your c++ code, you are trying to compile it using "g++ file.cpp", right?