如何降低gcc的版本?

编译打包和其他
回复
Helios
帖子: 2
注册时间: 2008-12-26 12:47

如何降低gcc的版本?

#1

帖子 Helios » 2008-12-26 13:01

I need installing gcc3.4. But I can't do it by synaptic.
头像
yawsh
帖子: 105
注册时间: 2006-04-29 10:51

Re: 如何降低gcc的版本?

#2

帖子 yawsh » 2008-12-28 11:34

你可以安装gcc-3.4
$sudo aptitude install gcc-3.4
然后你在看一下gcc的符号连接
$ ls -l /usr/bin | grep gcc
你或许可以看到/usr/bin/gcc 指向原来主机的版本,也许是4.2。
现在你可以删除掉/usr/bin/gcc,然后重新把gcc指向gcc-3.4
$sudo rm /usr/bin/gcc
$sudo ln -s /usr/bin/gcc-3.4 /usr/bin/gcc
这样子也许就可以了。以后如果你许需要用高版本的gcc,只要将gcc重新指向就可以了。
dbzhang800
帖子: 3182
注册时间: 2006-03-10 15:10
来自: xi'an China
联系:

Re: 如何降低gcc的版本?

#3

帖子 dbzhang800 » 2008-12-28 13:27

Helios 写了:I need installing gcc3.4. But I can't do it by synaptic.
通过新立得的肯定可以装gcc-3.4软件包,以下是不同版本ubuntu中的gcc-3.4包的具体版本信息
软件包 gcc-3.4
* dapper (devel): The GNU C compiler
3.4.6-1ubuntu2: amd64 i386 powerpc
* feisty (devel): The GNU C compiler
3.4.6-5ubuntu1: amd64 i386 powerpc
* gutsy (devel): The GNU C compiler
3.4.6-6ubuntu2: amd64 i386 powerpc
* hardy (devel): The GNU C compiler [universe]
3.4.6-6ubuntu3: amd64 i386
* hardy-updates (devel): The GNU C compiler [universe]
3.4.6-6ubuntu5: amd64 i386
* intrepid (devel): The GNU C compiler [universe]
3.4.6-8ubuntu2: amd64 i386
* jaunty (devel): The GNU C compiler [universe]
3.4.6-8ubuntu2: amd64 i386
如果你同时装有几个不同版本的gcc,运行时可以通过gcc的-V 参数来选择版本。
比如:

代码: 全选

gcc -V 3.4 hello.c
gcc -V 4.3 hello.c
回复