如何链接g ++ - > g ++ - 4.6到-4.7

时间:2013-09-03 13:08:01

标签: c++ ubuntu

我想改变g ++ - > g ++ - 4.6到-4.7但是我怎么能处理这种情况。

lrwxrwxrwx 1 root root      7 Sep  3 18:28 cpp -> cpp-4.7
-rwxr-xr-x 1 root root 306200 Apr 16  2012 cpp-4.6
-rwxr-xr-x 1 root root 527596 Apr 22 02:14 cpp-4.7
lrwxrwxrwx 1 root root      7 Mar 14  2012 g++ -> g++-4.6
-rwxr-xr-x 1 root root 310296 Apr 16  2012 g++-4.6
-rwxr-xr-x 1 root root 527596 Apr 22 02:15 g++-4.7
lrwxrwxrwx 1 root root      7 Sep  3 18:28 gcc -> gcc-4.7
-rwxr-xr-x 1 root root 306200 Apr 16  2012 gcc-4.6
-rwxr-xr-x 1 root root 527596 Apr 22 02:17 gcc-4.7
-rwxr-xr-x 1 root root  21988 Apr 22 02:17 gcc-ar-4.7
-rwxr-xr-x 1 root root  21988 Apr 22 02:17 gcc-nm-4.7
-rwxr-xr-x 1 root root  21988 Apr 22 02:17 gcc-ranlib-4.7
root@sudeep-Inspiron-1545:/usr/bin# ls -l g++
lrwxrwxrwx 1 root root 7 Mar 14  2012 g++ -> g++-4.6
root@sudeep-Inspiron-1545:/usr/bin# ln -s g++-4.7 g++
ln: failed to create symbolic link `g++': File exists
root@sudeep-Inspiron-1545:/usr/bin# 

1 个答案:

答案 0 :(得分:1)

您必须先删除现有链接:

rm g++

但是,您应该只使用update-alternatives