在 OSX 上更新 GCC

Update GCC on OSX(在 OSX 上更新 GCC)
本文介绍了在 OSX 上更新 GCC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

所以我是一个新程序员,我刚刚在我的 Macbook 上安装了 XCode 来获得 GCC.我认为 Xcode 是在 OSX 上获得 GCC 的唯一途径.现在,当我在 C++ 中运行我的 Hello World 应用程序时,g++ 出现说它是 4.0.1 版,但是当我查找以 g 开头的命令时,我也看到了 g++-4.2.有没有办法让 4.2 默认而不是 4.0.1,还有什么办法可以将 gcc 更新到最新版本 4.4.0?

So I am a new programmer and I just installed XCode on my Macbook to get the GCC. I think Xcode is the only way for getting GCC on OSX. Now when I run my Hello World application, in C++, g++ comes up saying it is version 4.0.1 but when I look for commands starting with g I also see g++-4.2. Is there any way of making 4.2 default rather than 4.0.1, and also is there a way to updating gcc to the latest version 4.4.0?

好的,所以我安装了 macports 并安装了 gcc4.4,它在终端上显示为 gcc-mp-4.4,以及如何使用 gcc_select 使其成为默认值,例如命令和内容.谢谢.

Ok, so I installed macports and installed gcc4.4 and it shows up on terminal as gcc-mp-4.4 and how do I make it default with gcc_select, like what are the commands and stuff. Thanks.

推荐答案

如果你安装macports你可以安装gcc select,然后选择你的gcc版本.

If you install macports you can install gcc select, and then choose your gcc version.

/opt/local/bin/port install gcc_select

要查看您的版本,请使用

To see your versions use

port select --list gcc

要选择一个版本使用

sudo port select --set gcc gcc40

这篇关于在 OSX 上更新 GCC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Returning a pointer of a local variable C++(返回局部变量 C++ 的指针)
Inline function linkage(内联函数联动)
Which is more efficient: Return a value vs. Pass by reference?(哪个更有效:返回值与通过引用传递?)
Why is std::function not equality comparable?(为什么 std::function 不具有可比性?)
C++ overload resolution(C++ 重载解析)
When to Overload the Comma Operator?(什么时候重载逗号运算符?)