Lion users are facing this problem:
Download and install MacPorts MacPorts-2.2.1-10.7-Lion.pkg . installation package from here
in the terminal, search for new versions of GCC:
$ port search --name --glob 'gcc*'
install a newer version (I went with gcc5)
$ sudo port install gcc5
get the name of your new version and set it as the default
$ port select --list gcc Available versions for gcc: llvm-gcc42 mp-gcc5 none (active) $ sudo port select --set gcc mp-gcc5
open a new terminal and confirm that you are updated:
$ c++ --version c++ (MacPorts gcc5 5.2.0_0) 5.2.0
source share