Recentemente ho installato gcc 4.8
utilizzando brew
su OSX 10.7.5 (Lion)
. Ora posso compilare usando gcc 4.8
usando
g++-4.8 some_file.c
o utilizzando il gcc 4.2
predefinito utilizzando
g++ some_file.c
Voglio usare gcc 4.8
come compilatore predefinito per Xcode
e se scrivo gcc
sul terminale. Suppongo che devo modificare gcc-related
link all'interno di dirname $(which gcc)
.
Quando faccio
ls -al $(dirname $(which gcc)) | grep 'gcc\|g++\|c++'
ottengo il seguente:
lrwxr-xr-x 1 root wheel 7 Jul 31 12:17 c++ -> clang++
-rwxr-xr-x 1 root wheel 909360 Nov 18 2011 c++filt
lrwxr-xr-x 1 root wheel 5 Jul 31 12:17 clang++ -> clang
lrwxr-xr-x 1 root wheel 12 Jul 31 12:17 g++ -> llvm-g++-4.2
lrwxr-xr-x 1 root wheel 12 Jul 31 12:17 gcc -> llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 28 Jul 31 12:17 gcov-4.2 -> ../llvm-gcc-4.2/bin/gcov-4.2
lrwxr-xr-x 1 root wheel 52 Jul 31 12:17 i686-apple-darwin11-llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-g++-4.2
lrwxr-xr-x 1 root wheel 52 Jul 31 12:17 i686-apple-darwin11-llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin11-llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 32 Jul 31 12:17 llvm-cpp-4.2 -> ../llvm-gcc-4.2/bin/llvm-cpp-4.2
lrwxr-xr-x 1 root wheel 32 Jul 31 12:17 llvm-g++ -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x 1 root wheel 32 Jul 31 12:17 llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x 1 root wheel 32 Jul 31 12:17 llvm-gcc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 32 Jul 31 12:17 llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
Quando corro: which gcc-4.8
Ottengo /usr/local/bin/gcc-4.8
.
I passaggi per ottenere questo risultato sarebbero molto utili.
Per favore e grazie.