-1

我想将 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# 
4

1 回答 1

1

您必须先删除现有链接:

rm g++

但是,您可能应该只使用update-alternatives代替。

于 2013-09-03T13:10:04.390 回答