2015-04-06 1 views
-1

Je suis nouveau sur linux et j'ai du mal à faire ce travail. J'ai désinstallé et installé gcc plusieurs fois. Maintenant, quand je cours gcc --version, il dit toujours zsh: command not found.GCC installé mais la commande n'a pas été trouvée

Quand je vais à /usr/local/bin et exécuter ls -l je trouve plusieurs versions de gcc

lrwxr-xr-x 1 ps032791 admin        33 Jul 2 2014 c++-4.6 -> ../Cellar/gcc46/4.6.4/bin/c++-4.6 
lrwxr-xr-x 1 ps032791 admin        33 Apr 6 11:58 c++-4.7 -> ../Cellar/gcc47/4.7.3/bin/c++-4.7 
lrwxr-xr-x 1 ps032791 admin        33 Apr 6 15:27 c++-4.8 -> ../Cellar/gcc/4.8.3_1/bin/c++-4.8 
lrwxr-xr-x 1 ps032791 admin        32 Apr 6 15:19 cloog -> ../Cellar/cloog/0.18.1/bin/cloog 
lrwxr-xr-x 1 ps032791 admin        33 Jul 2 2014 cpp-4.6 -> ../Cellar/gcc46/4.6.4/bin/cpp-4.6 
lrwxr-xr-x 1 ps032791 admin        33 Apr 6 11:58 cpp-4.7 -> ../Cellar/gcc47/4.7.3/bin/cpp-4.7 
lrwxr-xr-x 1 ps032791 admin        33 Apr 6 15:27 cpp-4.8 -> ../Cellar/gcc/4.8.3_1/bin/cpp-4.8 
lrwxr-xr-x 1 ps032791 admin        28 May 29 2014 erb -> ../Cellar/ruby/2.1.2/bin/erb 
lrwxr-xr-x 1 ps032791 admin        33 Jul 2 2014 g++-4.6 -> ../Cellar/gcc46/4.6.4/bin/g++-4.6 
lrwxr-xr-x 1 ps032791 admin        33 Apr 6 11:58 g++-4.7 -> ../Cellar/gcc47/4.7.3/bin/g++-4.7 
lrwxr-xr-x 1 ps032791 admin        33 Apr 6 15:27 g++-4.8 -> ../Cellar/gcc/4.8.3_1/bin/g++-4.8 
-rw-r--r-- 1 ps032791 admin        0 Apr 6 13:23 gcc-4.2 
lrwxr-xr-x 1 ps032791 admin        33 Jul 2 2014 gcc-4.6 -> ../Cellar/gcc46/4.6.4/bin/gcc-4.6 
lrwxr-xr-x 1 ps032791 admin        33 Apr 6 11:58 gcc-4.7 -> ../Cellar/gcc47/4.7.3/bin/gcc-4.7 
lrwxr-xr-x 1 ps032791 admin        33 Apr 6 15:27 gcc-4.8 -> ../Cellar/gcc/4.8.3_1/bin/gcc-4.8 
lrwxr-xr-x 1 ps032791 admin        36 Apr 6 11:58 gcc-ar-4.7 -> ../Cellar/gcc47/4.7.3/bin/gcc-ar-4.7 
lrwxr-xr-x 1 ps032791 admin        36 Apr 6 15:27 gcc-ar-4.8 -> ../Cellar/gcc/4.8.3_1/bin/gcc-ar-4.8 
lrwxr-xr-x 1 ps032791 admin        36 Apr 6 11:58 gcc-nm-4.7 -> ../Cellar/gcc47/4.7.3/bin/gcc-nm-4.7 
lrwxr-xr-x 1 ps032791 admin        36 Apr 6 15:27 gcc-nm-4.8 -> ../Cellar/gcc/4.8.3_1/bin/gcc-nm-4.8 
lrwxr-xr-x 1 ps032791 admin        40 Apr 6 11:58 gcc-ranlib-4.7 -> ../Cellar/gcc47/4.7.3/bin/gcc-ranlib-4.7 
lrwxr-xr-x 1 ps032791 admin        40 Apr 6 15:27 gcc-ranlib-4.8 -> ../Cellar/gcc/4.8.3_1/bin/gcc-ranlib-4.8 

Je courais 'médecin de bière', et je reçois la sortie suivante,

Warning: You have MacPorts or Fink installed: 
    /opt/local/bin/port 

This can cause trouble. You don't have to uninstall them, but you may want to 
temporarily move them out of the way, e.g. 

    sudo mv /opt/local ~/macports 

Warning: Your Homebrew is outdated. 
You haven't updated for at least 24 hours, this is a long time in brewland! 
To update Homebrew, run `brew update`. 

Warning: You have unlinked kegs in your Cellar 
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on 
those kegs to fail to run properly once built. Run `brew link` on these: 

    gcc48 

Warning: You have uncommitted modifications to Homebrew 
If this a surprise to you, then you should stash these modifications. 
Stashing returns Homebrew to a pristine state but can be undone 
should you later need to do so for some reason. 
    cd /usr/local/Library && git stash && git clean -d -f 

Warning: /usr/bin occurs before /usr/local/bin 
This means that system-provided programs will be used instead of those 
provided by Homebrew. The following tools exist at both paths: 

    erb 
    gem 
    git 
    git-cvsserver 
    git-receive-pack 
    git-shell 
    git-upload-archive 
    git-upload-pack 
    irb 
    rake 
    rdoc 
    ri 
    ruby 
    testrb 

Consider setting your PATH so that /usr/local/bin 
occurs before /usr/bin. Here is a one-liner: 
    echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile 

I Tried en cours d'exécution echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile , redémarré le terminal et a encore couru brew doctor, il se plaint toujours de la même chose. Je suis totalement perdu ici. Quelqu'un peut-il me guider avec ça? Qu'est-ce que je fais mal? Merci d'avance.

+0

vous êtes en utilisant 'zsh', mais en modifiant' .bash_profile'. cela ne correspond probablement pas à – leu

+0

vous pouvez avoir installé gcc, mais vous n'avez pas de lien symbolique nommé 'gcc' pointant sur l'une de ces exécutions. choisissez la version de gcc que vous voulez, et créez un lien symbolique. par exemple. 'ln/usr/bin/gcc/chemin/vers/cellar/gcc-4.8/gcc' –

+0

J'ai couru,' ln/usr/bin/gcc /usr/local/Cellar/gcc/4.8.3_1/bin/gcc- 4.8' et Il dit 'ln:/usr/bin/gcc: Aucun fichier ou répertoire'. J'ai traversé '/ usr/bin' et je n'ai pas pu trouver gcc non plus – user3438489

Répondre

1

Vous ne configurez pas le bon fichier de configuration. Check this out:

https://wiki.archlinux.org/index.php/Zsh#Configuring_.24PATH

Vérifiez que gcc est correctement installé:

brew install gcc 
brew link gcc48 

Créer un alias à tout brew lien créé et le mettre dans votre .zshrc

cd /usr/local/bin 
ls cpp* 
ls c++* 

alias gcc=/usr/local/bin/<whatever_link_you_found> 
+0

Merci, cela m'a aidé à résoudre le problème PATH. Mais toujours pas capable de lier gcc :( – user3438489

+0

Exécutez 'which gcc' et' gcc --version'. Quelle est la sortie de ces deux commande? Quelle distribution utilisez-vous? – ventsyv

+0

il dit 'gcc not found'. Je pense que j'ai Pour faire un lien symbolique comme le commentaire précédent, j'ai essayé de le faire aussi .. Référez-vous à mon commentaire – user3438489