Não é possível instalar o g ++

2

Como corrigir isso:

sahil@sahil-XPS-L501X ~ $ sudo apt-get install g++ 
Reading package lists... Done 
Building dependency tree        
Reading state information... Done 
Some packages could not be installed. 
This may mean that you have requested an impossible situation
or if you are using the unstable distribution that
some required packages have not yet been created 
or been moved out of Incoming. The following information
may help to resolve the situation:

The following packages have unmet dependencies:  
g++ : Depends: gcc (>= 4:4.8.1-2ubuntu3) but it is not going to be installed
       Depends: g++-4.8 (>= 4.8.1-4~) but it is not going to be installed
       Depends: gcc-4.8 (>= 4.8.1-4~) but it is not going to be installed 
E: Unable to correct problems, you have held broken package

sahil@sahil-XPS-L501X ~ $ sudo apt-cache policy g++ gcc g++-4.8 gcc-4.8
g++:
  Installed: (none)
  Candidate: 4:4.8.1-2ubuntu3
  Version table:
     4:4.8.1-2ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
gcc:
  Installed: (none)
  Candidate: 4:4.8.1-2ubuntu3
  Version table:
     4:4.8.1-2ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
g++-4.8:
  Installed: (none)
  Candidate: 4.8.2-1ubuntu1
  Version table:
     4.8.2-1ubuntu1 0
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ saucy/main amd64 Packages
     4.8.1-10ubuntu9 0
        500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
     4.8.1-10ubuntu8 0
        500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
gcc-4.8:
  Installed: (none)
  Candidate: 4.8.2-1ubuntu1
  Version table:
     4.8.2-1ubuntu1 0
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ saucy/main amd64 Packages
     4.8.1-10ubuntu9 0
        500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
     4.8.1-10ubuntu8 0
        500 http://archive.ubuntu.com/ubuntu/ saucy/main amd64 Packages
    
por Sahil Sareen 09.02.2014 / 19:41

2 respostas

5

Supondo que algo deu errado com pacotes debian, tente seguir:

dpkg  -l|grep -v ^ii

Isso lista todos os pacotes que não estão instalados corretamente.

dpkg -P package

Deinstall (Limpar) o pacote afetado.

dpkg -P --force-all package

Tente forçar se ainda for resistente.

dpkg --configure -a

Tente atualizar todos os pacotes ainda não configurados.

apt-get update

Atualize sempre antes de instalar novos pacotes.

apt-get install package

Agora deve estar ok.

    
por 09.02.2014 / 20:44
0

Instale gcc antes de instalar gcc-c++

sudo apt-get instala gcc
sudo apt-get instala gcc-c ++

Você pode encontrar mais informações sobre as dependências ausentes com apt-cache rdepends gcc

Certifique-se de executar apt-get update primeiro

    
por 09.02.2014 / 19:59