debian和Ubuntu安装c++开发环境
Ensure GCC is installed
Although you’ll use VS Code to edit your source code, you’ll compile the source code on Linux using the g++ compiler. You’ll also use GDB to debug. These tools are not installed by default on Ubuntu, so you have to install them. Fortunately, that’s easy.
虽然您将使用VS代码来编辑源代码,但您将使用g++编译器在Linux上编译源代码。您还将使用GDB进行调试。默认情况下,这些工具不会安装在Ubuntu上,因此您必须安装它们。幸运的是,这很容易
First, check to see whether GCC is already installed. To verify whether it is, open a Terminal window and enter the following command:
首先,检查GCC是否已经安装。要验证是否正确,请打开一个终端窗口并输入以下命令
gcc -v
If GCC isn’t installed, run the following command from the terminal window to update the Ubuntu package lists. An out-of-date Linux distribution can sometimes interfere with attempts to install new packages.
如果没有安装GCC,从终端窗口运行以下命令来更新Ubuntu包列表。过时的Linux发行版有时会干扰安装新软件包的尝试
sudo apt-get update
Next install the GNU compiler tools and the GDB debugger with this command:
接下来使用此命令安装GNU编译器工具和GDB调试器
sudo apt-get install build-essential gdb
参考资料
https://code.visualstudio.com/docs/cpp/config-linux