可以参考官方提供的文档 : https://code.visualstudio.com/docs/cpp/config-linux
在 Ubuntu 命令行中 , 执行
gcc -v
命令 , 查询当前的 gcc 编译器 版本 , 如果当前 gcc 编译器已经安装 , 则不需要处理 , 如果 gcc 没有安装 , 则会提示如下内容 :
octopus@octopus:~$ gcc-v
Command 'gcc-v' not found, did you mean:
command 'gcc-6' from deb gcc-6
command 'gcc-8' from deb gcc-8
command 'gcc-5' from deb gcc-5
command 'gcc-7' from deb gcc-7
Try: sudo apt install <deb name>
octopus@octopus:~$
此时需要安装 gcc 编译器 , 首先执行
sudo apt-get update
命令 , 更新 apt-get 源 ;
然后 , 执行
sudo apt-get install build-essential gdb
命令 , 安装 gcc 编译器 ;
安装完毕后 , 再次查询 gcc 版本 ;