Update GCC on OSX(在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 OSX 上更新 GCC


- DoEvents 等效于 C++? 2021-01-01
- 如何提取 __VA_ARGS__? 2022-01-01
- 将 hdc 内容复制到位图 2022-09-04
- OpenGL 对象的 RAII 包装器 2021-01-01
- 哪个更快:if (bool) 或 if(int)? 2022-01-01
- 将函数的返回值分配给引用 C++? 2022-01-01
- GDB 不显示函数名 2022-01-01
- 使用 __stdcall & 调用 DLLVS2013 中的 GetProcAddress() 2021-01-01
- XML Schema 到 C++ 类 2022-01-01
- 从父 CMakeLists.txt 覆盖 CMake 中的默认选项(...)值 2021-01-01