Ubuntu 配置 C/C++ 开发环境

系统环境

  • macOS Ventura 13.0.1

安装虚拟机

下载 VirtualBox

下载 VMware Workstation

安装 Ubuntu 操作系统

下载 Ubuntu 系统镜像

在虚拟机中安装 Ubuntu

How to install Ubuntu on VirtualBox?

Step-By-Step Procedure To Install Ubuntu Linux On VMWare Workstation

配置开发环境

sudo apt update && apt full-upgrade -y  # 更新系统
sudo apt install build-essential -y     # 安装编译工具
sudo apt install vim -y                 # 安装 vim 编辑器

简单测试

gcc --version
# 输出
gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
vim hello.c
#include<stdio.h>

int main(void){
  printf("hello word! \n");
  return 0;
}
# 按 ESC 输入 :wq 退出并保存文件
gcc -Wall hello.c -o hello
./hello

# 输出
hello word! 

VS Code

下载 Visual Studio Code for Linux

sudo dpkg -i code*

注意:Snap 版本的 VS Code 无法正常输入中文。


最后修改于 2023-02-03


感谢您的支持 :D