如何在Linux中使用gcc的旧版本 [英] How to use an older version of gcc in Linux

查看:151
本文介绍了如何在Linux中使用gcc的旧版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux中,我试图编译使用-fwritable-strings选项的东西。显然这是一个gcc选项,不适用于新版本的gcc。我在我的系统上安装了gcc-3.4,但我认为新版本仍在使用,因为我仍然收到错误,指出它无法识别命令行选项-fwritable-strings。如何使用旧版本的gcc?

解决方案

你对使用的构建系统一无所知,但通常旧版本的gcc可以通过类似的方式显式调用(这是基于自动工具的构建):

  ./ configure CXX = g ++  -  3.4 CC = gcc-3.4 

对于基于make的构建系统, work:

  make CXX = g ++  -  3.4 CC = gcc-3.4 

大多数makefile应该认识到覆盖 CC CXX 以这种方式。


In Linux I am trying to compile something that uses the -fwritable-strings option. Apparently this is a gcc option that doesn't work in newer version of gcc. I installed gcc-3.4 on my system, but I think the newer version is still being used because I'm still get the error that says it can't recognize the command line option -fwritable-strings. How can I get make to use the older version of gcc?

解决方案

You say nothing about the build system in use, but usually old versions of gcc can be invoked explicitly, by something like (this is for an autotools-based build):

./configure CXX=g++-3.4 CC=gcc-3.4

For a make-based build system, sometimes this will work:

make CXX=g++-3.4 CC=gcc-3.4

Most makefiles ought to recognise overriding CC and CXX in this way.

这篇关于如何在Linux中使用gcc的旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆