1.mac os å®è£
gcc
mac os å®è£ gcc
ä¸è½½å®æåï¼éè¿terminalè¿å ¥ä¸è½½ç®å½ï¼å³gcc-4.8-bin.tar.gzæå¨çç®å½ãè¾å ¥å½ä»¤ï¼
gunzip gcc-4.8-bin.tar.gz
解ågcc-4.8-bin.tar.gzå缩å ï¼æ³¨æåªéè¦è§£åä¸æ¬¡ï¼å¨åä¸ç®å½ä¸å¾å°gcc-4.8-bin.taræ件ã
3.继ç»å¨terminalä¸è¾å ¥å½ä»¤ï¼
sudo tar -xvf gcc-4.8-bin.tar
è¾å ¥å¯ç åï¼èªå¨å¨å½åç®å½ä¸çæäºusrç®å½ãcd /user/local/binå°±å¯ä»¥çå°ææçgccç¸å ³çå½ä»¤äºãå½ç¶ä½ ä¹å¯ä»¥å°æ´ä¸ªç®å½ç§»å¨å°ä½ éè¦çç®å½ã
4.æ·»å gccè·¯å¾ãå ³æå½återminalï¼éæ°æ°å»ºä¸ä¸ªterminalãè¾å ¥å¦ä¸å½ä»¤ï¼
touch ââ/.bash_profile
æ°å»ºä¸ä¸ªbash_profileæ件ï¼ä½¿ç¨viæè å ¶ä»ç¼è¾å¨åå ¥å¦ä¸ä»£ç ï¼
export PATH=â/Users/lizhaotailang/Gcc/usr/local/bin:$PATHâ
,源码html点击跳转源码å½ç¶è¿æ¯æçè·¯å¾ï¼å ·ä½çè·¯å¾æ ¹æ®ä½ çå®é æ åµèå®ãåå ¥å®æåå ³éæ件ã为äºä½¿æ件çæï¼è¿éè¦å¨terminalè¾å ¥
source ââï¼ãbash_profile
ã
5.æ¥çæ¯å¦çæãå¨terminalä¸è¾å ¥ï¼
echo $PATH
,å¦æè½å¤å¨è¾åºä¸çå°ååæ·»å çè·¯å¾å°±è¯´ææ·»å æåäºãæè ç´æ¥è¾å ¥gccå½ä»¤ï¼å¦æè½å¤çå°gccçclangé误èä¸æ¯æ¾ä¸å°æ件çè¯ï¼å°±è¯´æé ç½®æåäºã
6.ç¶åå°±å¯ä»¥æå¿«ç使ç¨gccäºã