如何在mac上找到gcc版本

sub*_*ngh 37 c macos gcc

我在mac机器上使用OS 10.9.我想知道我正在使用的gcc版本.所以我尝试gcc --version了终端,结果如下:

$ gcc --version
Configured with: --prefix=/Applications/Xcode5-DP.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode5-DP.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.1.58) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
Run Code Online (Sandbox Code Playgroud)

在输出中,没有与gcc相关的细节,但clang就在那里.我很困惑gcc命令是否执行clang或gcc(gnu).

dan*_*uzz 26

你似乎并不实际拥有的路径上的gcc.截至Xcode的最新版本,它安装了一个"gcc",而不是Clang的链接.

  • @danfuzz不是全部,请参阅[故意不支持的GCC扩展](http://clang.llvm.org/docs/UsersManual.html#intentionally-unsupported-gcc-extensions)和[GCC扩展尚未实现](http:// clang.llvm.org/docs/UsersManual.html#gcc-extensions-not-implemented-yet) (2认同)

Eri*_*hil 16

Apple提供的工具已从GCC切换到Clang.为方便起见,gcc命令链接到clang.在OS X 10.9中,除非您独立于Apple软件包安装了GCC,否则系统上没有GCC.


ser*_*hei 14

gcc -dumpversion | cut -f1 -d.
Run Code Online (Sandbox Code Playgroud)

  • @gsamaras随意玩`-f1`,`-f1,2`和`-f1,2,3` :) (5认同)
  • 我有 4.2.1,这仅给出 4。是东西!;) (2认同)