ubuntu 14.04更新GCC版本
按最基本的apt-get install gcc-8,不成功,提示如下。

按网上说的:apt-get update ,apt-get upgrade 后都无效果。
apt-cache search get 搜索后,发现资源链接里最新的也只有4.8.4所以不行。
需要更新资源链接,镜像地址。
1.替换软件更新源方法:
ubuntu 安装gcc 或g++ 时提示未发现软件包 gcc或g++_无法定位软件包gcc_只是个~小不点的博客-CSDN博客 2. 添加软件源方法
https://wenku.csdn.net/answer/881c213342fe46979aaba123b7ebbcf5
命令:sudo add-apt-repository ppa:ubuntu-toolchain-r/test来添加源,然后使用 sudo apt-get update命令来更新软件源。最后使用 sudo apt-get install gcc-8来安装。
3.使用update-alternatives指定GCC默认版本
https://blog.csdn.net/Nirvana15/article/details/122317525?spm=1001.2014.3001.5502
4.更新阿里云软件源也没有解决。最后用2中PPA的软件源安装成功。
1.
问题:安装gcc 或g++ 时提示未发现软件包?
1.这时,只需更新apt-get即可,那么apt-get是什么呢?
apt-get,是一条linux命令,适用于deb包管理式的操作系统,主要用于自动从互联网的软件仓库中搜索、安装、升级、卸载软件或操作系统。
输入命令:sudo apt-get update
如果更新时出现卡顿或很慢,是由于我们用的是外网,或者我们电脑的网络过慢
对于前者我的建议是换源
2.什么原因造成的呢?
因为我们安装好ubuntu双系统\单系统后,默认的软件更新源是国外的,
我们可以打开源目录看看:
先切换到目录:
cd /etc/apt
查看/编辑目录:
sudo vi sources.list
我们可以发现:里面的源都是关于cn.archive.ubuntu.com
这个就是国外的软件更新源
3.怎么解决呢?
国外的软件更新源在国内使用速度很慢,需要更换成国内的源,这样才能正常安装和更新软件。
怎么更换呢?
打开终端命令行界面中,先将sources.list文件备份一个,更新源服务器地址就是存在这个文件里面的,所以主要就是对这个文件进行编辑就可以了,也是很简单的。
1.先切换到目录:cd /etc/apt
2.备份源(防止意外或后续需要)
输入:sudo cp sources.list sources.list.old
3.编辑源:sudo vim sources.list
4.将文件中内容全部删除
5.更换源,有一下几种源可以选择,推荐阿里云
(1)、阿里云
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
(2)、清华大学
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
(3)、中科大
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
6、复制其中一种粘贴完后,要对照一下,有没有粘贴格式的错误或缺了哪些东西,然后保存退出。最后别忘了更新缓存。
输入:sudo apt-get update
更新缓存需要一点时间,更新完就可以了。
执行sudo apt-get update后续出现的问题,如没出现请忽略:
如输入:sudo apt-get update后出现这些信息
W: Unknown Multi-Arch type 'no' for package 'compiz-core'
W: Unknown Multi-Arch type 'no' for package 'compiz-gnome'
W: Unknown Multi-Arch type 'no' for package 'libxapian-dev'
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-min
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'kwin'
W: Unknown Multi-Arch type 'no' for package 'kwin-dev'
W: Unknown Multi-Arch type 'no' for package 'kwin-wayland'
W: Unknown Multi-Arch type 'no' for package 'kwin-x11'
W: Unknown Multi-Arch type 'no' for package 'libkf5sysguard-dev'
W: Ignoring Provides line with DepCompareOp for package php-psr-http-message-implementation
W: Ignoring Provides line with DepCompareOp for package php-psr-log-implementation
W: Ignoring Provides line with DepCompareOp for package php-seclib
W: Ignoring Provides line with DepCompareOp for package php-sabre-http
W: Ignoring Provides line with DepCompareOp for package php-math-biginteger
W: Ignoring Provides line with DepCompareOp for package pypy-cffi
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'compiz-core'
W: Unknown Multi-Arch type 'no' for package 'compiz-gnome'
W: Unknown Multi-Arch type 'no' for package 'libxapian-dev'
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-min
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'kwin-dev'
W: Unknown Multi-Arch type 'no' for package 'kwin-wayland'
W: Unknown Multi-Arch type 'no' for package 'kwin-x11'
W: Unknown Multi-Arch type 'no' for package 'libkf5sysguard-dev'
W: Ignoring Provides line with DepCompareOp for package pypy-cffi
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'compiz-core'
W: Unknown Multi-Arch type 'no' for package 'compiz-gnome'
W: Ignoring Provides line with DepCompareOp for package xserver-xorg
W: Ignoring Provides line with DepCompareOp for package php-math-biginteger
W: Ignoring Provides line with DepCompareOp for package pypy-cffi
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-min
W: Unknown Multi-Arch type 'no' for package 'compiz-core'
W: Unknown Multi-Arch type 'no' for package 'compiz-gnome'
W: Ignoring Provides line with DepCompareOp for package xserver-xorg
W: Ignoring Provides line with DepCompareOp for package pypy-cffi
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package pypy-cffi-backend-api-min
W: 您可能需要运行 apt-get update 来解决这些问题
怎么办呢?
执行如下命令:sudo apt-get install -f apt
再次输入:sudo apt-get update
OK,问题解决
3.选择GCC默认版本
#############切换gcc/g++版本##############
gcc -v
g++ -v
查看系统已有版本
ls /usr/bin/gcc*
ls /usr/bin/g++*
安装
sudo apt install gcc-4.9
sudo apt install g++-4.9# 安装 gcc-7 / g++-7
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-7
sudo apt-get install g++-7切换
先将需要的版本添加到 update-alternatives 中
# gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70# g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 40
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 70
若想删除,执行命令:sudo update-alternatives --remove gcc /usr/bin/gcc-4.9
手动配置 update-alternatives
sudo update-alternatives --config gcc
sudo update-alternatives --config g++输入版本编号
1、sudo apt-get remove gcc-*
sudo apt-get remove g++-* 卸载
2、sudo apt-get install gcc-*
sudo apt-get install g++-* 安装
3、 ls /usr/bin/gcc* -l 查询安装的gcc以及默认指向版本
4、修改默认的gcc和g++版本
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-* 40(*指某一版本,40代表优先级)
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-* 40 (*指某一版本,40代表优先级)
配置默认的gcc和g++
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
5、gcc--version 查询gcc版本
g++--version 查询g++版本
相关文章:
ubuntu 14.04更新GCC版本
按最基本的apt-get install gcc-8,不成功,提示如下。 按网上说的:apt-get update ,apt-get upgrade 后都无效果。 apt-cache search get 搜索后,发现资源链接里最新的也只有4.8.4所以不行。 需要更新资源链接,镜像地…...
AndroidUtil - 强大易用的安卓工具类库
官网 https://github.com/Blankj/AndroidUtilCode/blob/master/README-CN.md 项目介绍 AndroidUtilCode 🔥 是一个强大易用的安卓工具类库,它合理地封装了安卓开发中常用的函数,具有完善的 Demo 和单元测试,利用其封装好的 API…...
[多态设计模式]枚举
背景: 游戏服务器中,多态可以说体现的淋漓尽致。 如: 1.开启条件。有的系统是根据玩家等级,有的是根据通关第几关。 2.商店可能有不同类型的商店。 3.任务系统中,不同的计数类型,不同的任务目标类型。…...
【QT】QRadioButton的使用(17)
QRadioButton这个控件在实际项目中多用于多个QRadioButton控件选择其中一个这样的方式去执行,那么,今天这节就通过几个简单的例子来好好了解下QRadioButton的一个使用。 一.环境配置 1.python 3.7.8 可直接进入官网下载安装:Download Pyt…...
力扣:105. 从前序与中序遍历序列构造二叉树(Python3)
题目: 给定两个整数数组 preorder 和 inorder ,其中 preorder 是二叉树的先序遍历, inorder 是同一棵树的中序遍历,请构造二叉树并返回其根节点。 来源:力扣(LeetCode) 链接:力扣&am…...
【含java2023面试题】HashMap、HashTable、ConcurrentHashMap
作为Java中最常用的Map集合,HashMap、HashTable和ConcurrentHashMap都是线程安全的,但它们之间有什么区别呢?在本文中,我们将深入探讨这三种Map集合的区别,并通过Java代码示例来演示它们之间的差异。 AI绘画关于SD,MJ…...
AT24C02芯片
AT24C02简介: AT24C01/02/04/08/16...是一个 1K/2K/4K/8K/16K 位串行 CMOS内部有9个字节; 该器件通过 I2C 总线接口进行 操作,它有一个专门的写保护功能; 基于51 他有这个芯片操作 时序: AT24C02软件编程: …...
Python+Django前后端分离
程序示例精选 PythonDjango前后端分离 如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助! 前言 这篇博客针对《PythonDjango前后端分离》编写代码,代码整洁,规则,易读。 学习与应…...
win11系统固定到快速访问的文件夹无法调整顺序的问题
最近在使用win11系统时,固定到快速访问的文件夹无法调整顺序。网上搜了一大圈没有对应的解决方法,柳暗花明,在博主yin0hao的一篇文章中找到了类似的,跟着做了一下,结果问题也解决了。在此记录。 在文件资源管理器地址…...
短视频矩阵系统,短视频矩阵源码技术开发
开发短视频矩阵系统的源码需要以下步骤: 确定系统需求:根据客户的需求,确定系统的功能和特点,例如用户注册登录、视频上传、视频浏览、评论点赞等。 设计系统架构:根据系统需求,设计系统的整体架构&#x…...
Flask 数据库 连接池、DBUtils、http 连接池
1、DBUtils 简介、使用 DBUtils 简介 DBUtils 是一套用于管理 数据库 "连接池" 的Python包,为 "高频度、高并发" 的数据库访问提供更好的性能,可以自动管理连接对象的创建和释放。并允许对非线程安全的数据库接口进行线程安全包装…...
Day 01 python学习笔记
1、引入 让我们先写第一个python程序(如果是纯小白的话) 因为我们之前安装了python解释器 所以我们直接win r ---->输入cmd(打开运行终端) >python #(在终端中打开python解释器)>>>pri…...
CSharp Library develop histroy
1. .NET FRAMEWORK 发展版本 版本 完整版本号 发行日期 Visual Studio Windows 默认安装 1.0 1.0.3705.0 2002-02-13 Visual Studio .NET 2002 Windows XP Media Center Edition Windows XP Tablet PC Edition 1.1 1.1.4322.573 2003-04-24 Visual Studio .NET 2…...
林木种苗生产vr虚拟实训教学降低培训等待周期
林业种植管理在保护水土流失、气候变化及经济社会发展中发挥重要的作用,林业教学往往需要进入林区进行实操察验,在安全性、时间及效率上难以把控,因此有更多林业畜牧院校创新性地引进VR虚拟现实技术。 在林业领域,实地调查是获取准…...
LabVIEW在运行时调整表控件列宽
LabVIEW在运行时调整表控件列宽 如何在LabIEW中运行时调整表控件的列宽大小? 在VI运行时,有两种不同的方法可以更改表中列的宽度。首先,可以使用鼠标手动更改它们;其次,可以从框图中以编程方式更改它们。 手动更改列宽 只有在…...
【6 ElementUI Tabs控件第二个tab页签Div宽度缩小的问题】
背景 在使用ElementUI的Tabs 控件时,发现第二个tabs 内容的Div宽度用的百分比,然后就会缩小,导致内容变形,这边的处理方法就是拿到一个tabs 内容的div的offsetWidth,然后将这个width赋值给第二个Div的width即可。 代…...
读写分离MySQL
利用Mycat控制后台数据库的读写分离和负载均衡 利用主从复制思想,实现读写分离,主库写,从库读 从库最好不要写,因为从库写入的数据不能同步到主库,只有主库写的数据才能同步到从库 balance属性值对应的含义(负载均衡) 一主一从读写分离的弊端 主节点Master宕机以后,业务系统…...
MySQL数据库用户管理
MySQL数据库用户管理 1、数据库权限1.1什么是数据库权限1.2数据库权限分类1.3用户管理 2、用户授权2.1grant提权2.2查看权限2.3撤销权限 3、修改密码3.1修改当前用户密码3.2修改其他用户密码3.3修改root密码 4、远程登录4.1远程登录4.2软件远程登录 5、总结 1、数据库权限 1.1…...
package.json属性
添加链接描述 一、必须属性 name 定义项目的名称,不能以".“和”_"开头,不能包含大写字母version 定义项目的版本号,格式为:大版本号.次版本号.修订号 二、描述信息 description 项目描述keywords 项目关键词author …...
C# 把m4a格式文件转为MP3格式
直接上代码: 先引用 using NAudio.Wave; using NAudio.Lame; 1, 文件列表来自于根目录里所有的m4a文件 string directloc "G:\mp3\MP3"; string[] fyles Directory.GetFiles(directloc); NAudio.Wave.BlockAlignReductionStream stream …...
干货 | SpringBoot 缓存实战:击穿、穿透、雪崩 通俗解决方案(附可落地代码)
一、前言做 Java 后端开发,只要用了 Redis 缓存,缓存击穿、缓存穿透、缓存雪崩这三个坑绕不开。面试必问、线上必踩。本文不讲晦涩底层源码,用大白话讲原理 SpringBoot 可直接复制的实战代码,新手能看懂,项目能直接上…...
AI编程实战:从零到一搭建全栈项目
1. 引入 在现代 AI 工程中,Hugging Face 的 tokenizers 库已成为分词器的事实标准。不过 Hugging Face 的 tokenizers 是用 Rust 来实现的,官方只提供了 python 和 node 的绑定实现。要实现与 Hugging Face tokenizers 相同的行为,最好的办法…...
使用AI完成Swagger接口类型在前端自动生成的工具
厌倦了手写 TypeScript 类型?我做了一个工具帮你从 Swagger 自动生成 背景:一个让人抓狂的日常 做前端的同学应该都经历过这种场景: 后端给你一个新接口,你打开接口文件,写下: export async function g…...
CH32X035 USB MIDI免驱库:RISC-V嵌入式音乐硬件开发指南
1. 项目概述CH32X035_USBMIDI 是一款专为沁恒电子(WCH)CH32X035 系列 RISC-V 微控制器设计的高性能 USB MIDI 设备库。该库并非基于通用 CDC ACM 框架的简单封装,而是深度绑定 CH32X035 片上 USBFS(USB Full-Speed)硬件…...
从HCCDA题库看实战:GaussDB开发者必须掌握的10个核心操作(附实验截图指南)
从HCCDA题库看实战:GaussDB开发者必须掌握的10个核心操作(附实验截图指南) 在数据库技术的世界里,认证考试往往被视为理论知识的试金石,但真正考验开发者能力的,是如何将这些理论转化为实际生产力。GaussDB…...
怎样评估数据化管理?数据化管理如何持续改进?
在数据这个行当工作了这么多年,我经常会和不同公司的朋友聊天。大家刚开始做数据化管理时总是干劲十足,买工具、建报表、做大屏。但一两年后,常常陷入一种困惑:钱花了,屏挂了,但感觉业务还是老样子。这时候…...
3分钟搞定GitHub加速:国内开发者必备的免费终极解决方案
3分钟搞定GitHub加速:国内开发者必备的免费终极解决方案 【免费下载链接】Fast-GitHub 国内Github下载很慢,用上了这个插件后,下载速度嗖嗖嗖的~! 项目地址: https://gitcode.com/gh_mirrors/fa/Fast-GitHub 还在为GitHub龟…...
基于VLFM的中文指令视觉语言导航系统设计与实现
基于VLFM的中文指令视觉语言导航系统设计与实现 一、引言 1.1 项目背景 视觉语言导航(Vision Language Navigation,VLN)是具身智能领域的核心任务之一,其目标是让智能体根据自然语言指令在三维环境中自主导航,完成路径规划与空间定位任务[reference:0]。近年来,随着大…...
手把手教你用ESP32-S3开发智能语音设备:麦克风选型+WAV录音全流程
ESP32-S3智能语音设备开发实战:从麦克风选型到WAV录音全流程解析 1. 智能语音设备开发的核心挑战与ESP32-S3解决方案 在智能家居和物联网设备爆发式增长的今天,语音交互已成为人机交互的重要方式。然而,开发一款高性能的智能语音设备并非易…...
手把手教你理解半导体中的电阻优化:polycide与salicide的实战应用
半导体工艺中的电阻优化艺术:深入解析polycide与salicide技术 在28nm以下先进制程中,金属硅化物技术已成为决定芯片性能的关键因素。当我们翻开任何一款现代处理器的版图,polycide和salicide这两种看似相似的工艺,实际上在晶体管的…...
