为什么我的g ++和gcc版本没有升级?

时间:2015-01-29 19:10:26

标签: eclipse xcode macos c++11

我在Mac上。我将我的OSx更新为Yosemite。我将我的xcode更新到版本6.我下载了命令行工具。

然而,每当我输入g ++ --version时,我得到:

# g++ --version
couldn't understand kern.osversion `14.1.0'
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

意思是,我仍在使用旧版本的g ++和gcc。

为什么没有升级?我有兴趣在Eclipse中使用c ++ 0x,为此我需要一个更新的g ++ / gcc编译器。

编辑:在下面的评论之后,我有两个问题:

为什么

$ clang --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

我似乎还有旧版的clang吗?

为什么没有安装xcode,命令行工具会创建到clang的正确链接?

2 个答案:

答案 0 :(得分:0)

看起来您可能还安装了旧版本的xcode。 从命令行,您可以使用

切换到正确的命令行
xcode-select --switch <path>

你应该看到类似的东西

$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

$ clang --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

答案 1 :(得分:0)

升级到yosemite后,我遇到了类似的安装ios-deploy的问题。我得到了相同的

couldn't understand kern.osversion `14.1.0'

对于gcc。我最终通过以下方式解决了这个问题:

cd /opt/local/bin/
sudo rm gcc
sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/gcc gcc

这正确指向了Xcode 6.1提供的版本。

相关问题