問題描述
所以我是一個新程序員,我剛剛在我的 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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!