ユーザーのデフォルトのgccバージョンを設定する方法は?

ユーザーのデフォルトのgccバージョンを設定する方法は?

私は他の人とサーバー(Ubuntu 11.04)を共有しており、コードを書くためにgcc 4-4を使用する必要がある唯一の人であり、残りは4.5を使用します。 gcc 4.4をインストールしましたが、他の人を邪魔することなくどのようにデフォルトバージョンに設定できますか?

ソリューションはMakefilesなどで動作するはずです。

jw013のアイデアを試しましたが失敗したようです。シンボリックリンクを作成しましたln -s /usr/bin/gcc-4.4 ~/bin/gccこれで.bashrcロードされなくなりました。エラーメッセージは次のとおりです。

Command 'lesspipe' is available in the following places
 * /bin/lesspipe
* /usr/bin/lesspipe
The command could not be located because '/usr/bin:/bin' is not included in the PATH environment variable.
lesspipe: command not found
Command 'dircolors' is available in '/usr/bin/dircolors'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
dircolors: command not found
Command 'uname' is available in '/bin/uname'
The command could not be located because '/bin' is not included in the PATH environment variable.
uname: command not found
-bash: [: =: unary operator expected
Command 'sed' is available in '/bin/sed'
The command could not be located because '/bin' is not included in the PATH environment variable.
sed: command not found
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found

ベストアンサー1

私が考える最も簡単な方法は、ディレクトリ内にディレクトリを~/bin作成し、現在の場所に$HOMEシンボリックリンクを追加してから、次のようにそのディレクトリが先頭にあることを確認することです。~/bin/gcc/usr/bin/gcc-4.4gcc-4.4~/bin$PATH

export PATH=~/bin:$PATH

おすすめ記事