zoukankan      html  css  js  c++  java
  • Ubuntu 上多版本软件管理方法

    https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/

    sudo apt install software-properties-common
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    
    Copy

    Install the desired GCC and G++ versions by typing:

    sudo apt install gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9
    
    Copy

    The commands below will configure alternative for each version and associate a priority with it. The default version is the one with the highest priority, in our case that is gcc-9.

    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/gcov gcov /usr/bin/gcov-7
    
    Copy

    Later if you want to change the default version use the update-alternatives command:

    sudo update-alternatives --config gcc
    
    Copy
    There are 3 choices for the alternative gcc (providing /usr/bin/gcc).
    
      Selection    Path            Priority   Status
    ------------------------------------------------------------
    * 0            /usr/bin/gcc-9   90        auto mode
      1            /usr/bin/gcc-7   70        manual mode
      2            /usr/bin/gcc-8   80        manual mode
      3            /usr/bin/gcc-9   90        manual mode
    
    Press <enter> to keep the current choice[*], or type selection number:
    Copy

    You will be presented with a list of all installed GCC versions on your Ubuntu system. Enter the number of the version you want to be used as a default and press Enter.

    The command will create symbolic links to the specific versions of GCC and G++.

  • 相关阅读:
    [stm32] Systick
    [stm32] GPIO及最小框架
    51单片机-PC数据传输 温度 距离 监控系统设计
    [游戏学习29] Win32 图像处理1
    [51单片机] 串口通讯 简单通信
    [汇编] 闰年计算
    Java常用工具类之ArrayUtil
    常用工具类系列之DateUtil
    SpringBoot 获取当前登录用户IP
    Spring data jpa Specification查询关于日期的范围搜索
  • 原文地址:https://www.cnblogs.com/lightsong/p/11839284.html
Copyright © 2011-2022 走看看