文章目录
本文主要用于在Ubuntu系统和Windows系统上用C语言编写简单程序。其中Ubuntu系统有两种编写方式:一种是用gcc命令行方式;一种是用Makefile方式。
一、设置网络参数
1.通过虚拟机设置选择NAT模式
2.选择“编辑”中的“虚拟网络编辑器”
3.选中NAT模型,然后再依次选择“更改设置”、“还原默认设置”,“确定”。
4.重启虚拟机,就能保证虚拟机能上网。
二、修改系统参数(换源)
1.查看系统代号:
输入以下命令:lsb_release -c
这里作者用的Ubuntu 18.04版本,系统代号为bionic。``
2.源文件备份
输入以下命令:sudo cp sources.list sources.list.bak
2.源文件编辑
输入以下命令:sudo vim /etc/apt/sources.list
若提示vim not found即需要下载vim:
输入:sudo apt-get install vim
即可下载。
进入编辑界面,将里面的数据替换为国内源即可。
这里笔者更换的是阿里源:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http