Reputation: 561
So I downloaded gcc using homebrew so that I could update gcc and g++ to 4.7.
So then I:
$ mkdir ~/bin
created ~/.bashrc
with contents:
'export PATH=$HOME/bin:$PATH'
created ~/.bash_profile
with contents:
'. $HOME/.bashrc'
and then:
$ ln -s /usr/local/bin/g++-4.7 ~/bin/g++
so now I run g++ -v and it's 4.7
, YAY!
Now I go to update gcc and do:
$ ln -s /usr/local/bin/gcc-4.7 ~/bin/gcc
I get no errors but then when I run gcc -v i get:
gcc-4.7: error trying to exec '/usr/local/bin/i686-apple-darwin10-gcc-4.2.1': execvp: No such file or directory
So it seems to be looking for 4.2 for some reason? If I cd to ~/bin/gcc
and do ./gcc -v
it works fine. Also echo $PATH has the correct ~/bin path
. I'm not sure why g++ worked and gcc didnt.
Upvotes: 0
Views: 794
Reputation: 41
I had the same problem. This is because bash has hashed the gcc in other folder.
run: hash gcc
Then everything should go smooth.
Upvotes: 4