Install gcc on Ubuntu 12.04 LTS
Solution 1:
There's a metapackage called build-essential
which should install the compiler and a bunch of related/needed packages:
sudo apt-get install build-essential
The suggestion to first do sudo apt-get update
is sound, this will update package lists and all versions should match nicely.
That is, however, if you didn't modify your /etc/apt/sources.list
file manually. If so, then maybe some of the changes you made or repositories you added contain conflicting packages which cause the problems you see. If that's the case, please look at the file and fix the troublesome entries. Of course, if you want help doing so, you can post your sources.list
file (or any fragments in /etc/apt/sources.list.d
) and maybe someone can help you fix them.
Solution 2:
Try to keep going deeper:
sudo apt-get update
sudo apt-get install gcc-4.6-base cpp-4.6 libgomp1 libquadmath0 libc6-dev