刚安装了Ubuntu,在网上复制粘贴了阿里源地址更换后,安装了gcc vim,但在gcc编译时一些头文件stdio.h都显示找不到。
报错如下:

解决方法:
1.输入命令lsb_release -a查看当前系统Codename的值,该值即为系统代号。此处为jammy,对应的软件源应该保持一致。

2.更改软件源地址
cd /etc/apt
sudo gedit sources.list
#打开后将下面内容复制粘贴到该文件中
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
3.更新软件源
sudo apt-get update
4.卸载原有不匹配的gcc vim
sudo apt-get remove gcc
sudo apt-get remove vim
5.重新安装gcc vim
sudo apt-get install gcc
sudo apt-get install vim
6.再次gcc编译,编译通过

Ubuntu安装gccvim后无法找到头文件的解决办法
467

被折叠的 条评论
为什么被折叠?



