How to change the default GCC compiler in Ubuntu?

后端 未结 8 1400
孤街浪徒
孤街浪徒 2020-11-28 17:44

I have installed gcc-3.3/g++-3.3 on ubuntu 11.04 which already has gcc/g++-4.4. So in my system both gcc-3.3 and 4.4 are available. I am able to call both compilers as I wan

8条回答
  •  猫巷女王i
    2020-11-28 18:27

    This is the great description and step-by-step instruction how to create and manage master and slave (gcc and g++) alternatives.

    Shortly it's:

    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
    sudo update-alternatives --config gcc
    

提交回复
热议问题