Pintaste Pintaste

Setting Up C/C++ Development Environment on Ubuntu

1 min read 44 words 阅读中文版

System Environment

  • macOS Ventura 13.0.1

Install Virtual Machine

Download VirtualBox

Download VMware Workstation

Install Ubuntu Operating System

Download Ubuntu Desktop Image

Install Ubuntu in Virtual Machine

How to install Ubuntu on VirtualBox?

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

Configure Development Environment

sudo apt update && apt full-upgrade -y  # Update system
sudo apt install build-essential -y     # Install build tools
sudo apt install vim -y                 # Install vim editor

Simple test

gcc --version
# Output
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;
}
# Press ESC and type :wq to save and exit
:gcc -Wall hello.c -o hello
./hello

# Output
hello word! 

VS Code

Download Visual Studio Code for Linux

sudo dpkg -i code*

Note: The Snap version of VS Code cannot input Chinese properly.

CC BY-NC-SA 4.0 · pintaste

Comments

Giscus comments activate once PUBLIC_GISCUS_* env vars are set.