更换Ubuntu软件源
1、打开软件和更新
选择其他站点,选阿里云的软件源,提高更新的速度
安装gcc
1、在终端窗口中输入sudo apt update,输入用户密码回车即可更新包列表
sudo apt update
2. 安装build-essential软件包
sudo apt install build-essential
3. 验证GCC编译器,输入gcc --version命令之后,出现下图所示标识gcc配置成功,然后才可以调试程序
gcc --version
4. 编译c代码,生成hello.obj文件
gcc hello.c -o hello.obj
5.执行obj文件,命令行中输入./chapter1.obj,即可执行程序,查看运行结果