简体   繁体   中英

GCC on Mac OSX--multiple versions of gcc

I think I have several versions of gcc installed on my Mac OSX. Right now, when I type gcc --version. I got gcc (GCC) 4.6.0 20100703 (experimental) . But I want to use earlier version gcc. The thing is, i don't know how to find the path of older version gcc. Can anyone help me? Thanks.

By default, your gcc installations should be in /usr/bin/ . So, for example, to use gcc 4.2, you'd use /usr/bin/gcc-4.2 to compile your files. You can do ls /usr/bin/gcc* to see which ones you have installed.

EDIT:
If gcc isn't installed in the default path (ie, /usr/bin/ ), then you can execute locate gcc in the terminal to find where it is located.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM