The MacBook is defined as clang, while the Orthodox GNU GCC can only use gcc-7 (gcc 7), however, if you modify the/usr/bin link, it is also prone to system errors because the Mac's toolchain and GCC (clang) are highly integrated, searching for , found that a master through the clever use of alias to solve the problem perfectly, but also can be in need, at any time undo.
under User directory, modify the. bash_profile file alias gcc="gcc-7"alias cc=" Gcc-7"alias G++="g++-7"alias C++=" c++-7 "
The original text is as follows: Https://apple.stackexchange.com/questions/99077/how-to-set-gcc-4-8-as-default-gcc-compiler
Thanks to the your help. I ended up just creating aliases within as ~/.bash_profile
follows:
alias gcc=‘gcc-4.8‘alias cc=‘gcc-4.8‘alias g++=‘g++-4.8‘alias c++=‘c++-4.8‘
This was basically what Lyken suggested but easier to undo if necessary.
Reference article: http://blog.csdn.net/u010167269/article/details/51951582
Replace GCC with GNU gcc in MacBook