100

I am trying to install G++ compiler in Ubuntu 13.10. It told me I needed to install the build-essential package.

I have tried the below code

sudo apt-get update
sudo apt-get install build-essential

It gives me this error:

Reading package lists... Done
Building dependency tree 
Reading state information... Done
E: Couldn't find package build-essential
Eliah Kagan
  • 119,640

6 Answers6

90

Type in the Terminal sudo apt-get install build-essential and then press key TAB instead of pressing ENTER.

Parto
  • 15,647
Ngoc
  • 949
50

Enable main repository in Software & Updates.

Then run these commands in a terminal:

sudo apt-get update
sudo apt-get install build-essential
Eliah Kagan
  • 119,640
Avinash Raj
  • 80,446
10

You have to enable the main repository in the /etc/apt/sources.list file.
To accomplish this remove the '#' character in front of the following lines.

#deb http://de.archive.ubuntu.com/ubuntu/ saucy-updates main restricted
#deb-src http://de.archive.ubuntu.com/ubuntu/ saucy-updates main multiverse restricted universe

Save the file and execute
sudo apt-get update && sudo apt-get install build-essential.

ElefantPhace
  • 3,281
Peter Parker
  • 361
  • 2
  • 9
9

Well, sometimes what happens is that if your first command fails due to some repo not responding or other network issues

sudo apt-get update

Then you may not be able to install build-essential. So always ensure that apt-get update completes successfully. Once update is commpleted, issue:

sudo apt-get install build-essential

Now you should be able to install it successfully.

2

You can also install build essentials from software center
Open it up, and search for "build essential"

ElefantPhace
  • 3,281
Meow
  • 1,427
2

These terminal commands should solve your problem:

First remove the Merge List by opening a terminal (Press Ctrl+Alt+T to launch) and run this command:

sudo rm /var/lib/apt/lists/* -vf

or

sudo rm -vf /var/lib/apt/lists/*

these command lines are interchangable

the options used are -v verbose

-v, --verbose explain what is being done

and -f force

-f, --force ignore nonexistent files and arguments, never prompt

If you are ever unsure about a command line or the options being used always refer to the manual page for the command. These can be accessed on the internet by searching for man and the command for example man rm or you can access the same information by typing exactly the same command in the terminal for example man rm instructions for quitting the page will be at the bottom of the terminal like this

picture of man page options

Next, generate a new one by running a simple update:

sudo apt-get update

Then do,

sudo apt-get install build-essential