OS X 10.9 gcc links to clang

柔情痞子 提交于 2019-12-17 03:55:12

问题


I just noticed that after installing OS X 10.9, the g++ compiler links to the clang compiler. Is there anyway to revert back to gcc/g++?


回答1:


It has been this way for a long time already. The "GCC" that came with 10.8 was really GCC front-end with LLVM back-end.

The best way to get GCC is via Homebrew. After the one-line homebrew install command on the bottom of the linked page, you just need:

$ brew install gcc49

Unlike macports, Homebrew doesn't clutter your system dirs and it's much better at managing versions and uninstalls. It also doesn't require the crutch known as sudo.




回答2:


You'd have to install it from macports:

$ sudo port install gcc49

However I am not certain how you'd integrate gcc into Xcode 5, however you don't mention why you cannot use clang?




回答3:


Accessible and up to date GCC packages are at http://hpc.sourceforge.net/




回答4:


you can also get a g++ compiler from http://hpc.sourceforge.net/. They have the compiler in a pre-built package. Just download and follow their directions. Note you may need to change your executable PATH and have /usr/local/bin ahead of /usr/bin. This is to insure g++ calls the right compiler.




回答5:


This is by design, and not new in OS X 10.9. Apple deprecated GCC a long time ago. Just use Clang, or if you need fortran/openmp/..., install GCC yourself through homebrew/macports/...



来源:https://stackoverflow.com/questions/19535422/os-x-10-9-gcc-links-to-clang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!