question:
When installing vim and gcc in ubantu to run the C language experiment, because the download failed, I tried to use the interface method to switch to Alibaba Cloud in Settings-About-Software Update, and then the download was successful but gcc reported the following error:
Then refer to the following article, using the above user interface to change the source many times to no avail. GCC compiles and reports an error fatal error: stdio.h: No such file solution
Found that it fits the following two articles, after trying again
发现apt-get install build-essential 报错如下
Solution (manually change Tsinghua source):
Manually change the mirror source, the process is as follows:
1 Enter Tsinghua University Open Source Software Mirror Station | Tsinghua Open Source Mirror
Search for ubantu and click on the question mark in the picture
Choose your own version, copy the code
2 backup default sources (optional)
The first parameter is the copied file path and file name, and the second is the copied (pasted) file path and file name.
sudo cp /etc/apt/sources.list /etc/apt/sources.bak1
3 Open it with the gedit editor that comes with ubuntu, then clear the content in the Jiang sources.list file, and then copy the corresponding domestic sources into it.
sudo gedit /etc/apt/sources.list
4 Execute the following two commands
sudo apt-get update
#这个命令,会访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。我们在新立得软件包管理器里看到的软件列表,都是通过update命令更新的。
sudo apt-get upgrade
#这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本太低,就会提示你更新。如果你的软件都是最新版本,会提示:
#升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
5 重新执行 apt-get install build-essential
After the installation is complete and correct, gcc can be used normally