How to switch the GCC compiler on MAC (macports)
The method here is implemented through the PORT command option, so you need to install macports first. The specific installation steps are not mentioned. The command for switching to different GCC versions is as follows:
Run:
$ Sudo port select -- list gcc
Display:
Password:
Available versions for GCC:
Gcc42
Llvm-gcc42
Mp-gcc45)
None
Select the llvm-gcc42 as the compiler and execute:
$ Sudo port select -- set GCC llvm-gcc42.
Display:
Selecting 'llvm-gcc42' for 'gcc 'succeeded. 'llvm-gcc42' is now active.
Previous versions of macports used gcc_select to switch to the GCC version. However, today, I failed to execute the command. I found that gcc_select was canceled by voting on the official website and implemented by the Select parameter.
2
Http://stackoverflow.com/questions/810892/update-gcc-on-osxclick to open the link
$ Sudo port select -- list gcc
AvailableVersionsForGcc:Gcc42llvm-Gcc42mp-Gcc46none(Active)
To set GCC to the macports version:
$ Sudo port select -- set GCC mp-gcc46.