The correct way to upgrade from llvm-g ++ - 4.2 to g ++ - 4.7 on Mac

I have Lion 10.7.3 with a command line tool installed. I wanted to experiment with C ++ 11, so I used homebrew to install GCC 4.7, as described here .

How can I update / usr / bin / g ++ so that it is installed using Homebrew? Is it as simple as symbolic binding? I just want to double check and make sure. Thank!

+5
source share
1 answer

First, are you sure you need g ++ 4.7? As you can see on the C ++ 11 page , the latest versions of clang support most C ++ 11. Of course, there are things that g ++ handles, and clang does not, but there are still things that support clang, but g ++ does not. And, more importantly, you already have the latest version of clang, from Apple, configured and ready to go, as your default compiler. In addition, g ++ after 4.2 does not support Mac extensions, for example, -archwhich means you cannot use it to create a lot of third-party software (since most configure scripts assume that if you are on a Mac, your compiler supports Mac extensions) .


g++ 4.7, . /usr/bin/g++ . /usr/bin ( /System) -Apple, ( -, , ).

. Homebrew ( , /usr/local/Cellar/gcc/ 4.7, /usr/local/bin ..) .

g++ /usr/local/bin/g++ g++-4.7.

, /usr/local/bin PATH, /usr/bin, CXX $CXX g++.

GUI IDE, , -. ( Xcode, Apple .)


, . , . ; configure && make .

, , CXX ++ CC C . ( CXX .)

, g++ 4.7 Mac, , configure autoconf, , , , -arch x86_64 Mac .., .

+3

All Articles