You are on page 1of 23

UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Practice C_programming

Instruction to install
Visual Studio Code and MinGW software

Dr. Tong Si Son/Hoang Duc Thuong


Space and Applications Department

1
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Practice C_programming

Step 1: Install Visual Studio Code (For both Windows and IOS)
Visual Studio Code is a code editor redefined and optimized for building and debugging modern
https://code.visualstudio.com/

Step 2: Install MinGW (For Windows only)


 Mingw-w64 is an advancement of the original mingw.org project, created to support the GCC
compiler
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/
Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download

2
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Practice C_programming
Step 1: Install Visual Studio Code (For both Windows and IOS)
Visual Studio Code is a code editor redefined and optimized for building and debugging modern
https://code.visualstudio.com/

Run as default by
Next->> Next ….

3
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Practice C_programming
Step 2: Install MinGW (For Windows only)
 
Mingw-w64 is an advancement of the original mingw.org project, created to support the GCC
compiler
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/
Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download

Run: MinGW setup Next: (Destination folder : default)

Remember
this path

4
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Practice C_programming
2.1 Copy the Path of installed MinGW to the Environment variables of Windows

5
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Note: If cannot run the Installation of MinGW, please download a MinGW version in “https://winlibs.com/#download-
release” then extract the zip file, copy the extracted folder to C driver (ex. C:\mingw64), continue the next steps

2.1 Paste the Path of installed MinGW to the Environment variables of 3/Click to
Windows Advanced

2/ Click to
Advanced
System Setting

1/ Click to
Properties of 4/Environment
This compute 6
Variables
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Practice C_programming
2.1 Paste the Path of installed MinGW to the Environment variables of Windows
7/Click to
New

6/ Click to Edit

8/ Paste the
9/OK to finish
copied “Path”
5/ Click to of MinGW64
“Path” line

7
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Practice C_programming
2.2 Test if the GCC is running 3/Type gcc --version
2/ Open cmd.exe

4/OK! Done! If it
appears this line

8
1/ Find cmd.exe
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Configuration Visual
Studio Code (VSC).
Let’s open Visual Studio Code 

9
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

2/ Search and
Step 3: Visual Studio Code Extensions install:
C/C++

1/ click on the
extension

10
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Practice C_programming 3/ Search and


install:
Code Runner

11
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

If you want the result on


the terminal of visual
studio code.

12
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

2/ Click
here on
Setting

1/ Click here
on the visual
studio code

13
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

1/ Click on
extensions

2/ Click on
Run code
configuration

14
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT


3/ Scroll down
and check on:
Run in terminal

15
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

2/ On the 1/ When you


3/ You see the run a script
output terminal

16
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Configuration on Mac OS

17
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

• Check whether gcc is ready: $gcc --version


• If not, then install: $brew install gcc or $pip install gcc
• If not, you have to install Xcode first: https://developer.apple.com/download/more/?q=
Xcode

18
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Configuration on Mac OS

19
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Configuration on Mac OS

1/
Search: C/C++

when you see:


Edit configurations (JSON) 20
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

Modify file: c_cpp_properties.json


Note that this file is belong to vscode

Open c_cpp_properties.json

21
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++98",
"intelliSenseMode": "macos-clang-x64"
}
],
"version": 4
} 22
UNIVERSITY OF SCIENCE AND TECHNOLOGY OF HANOI

SPACE AND APPLICATIONS DEPARTMENT

If everything is too complicated.


You can use “online C compliers”
to follow the practical tutorials.

Example:
https://www.programiz.com/c-programming/online-com
piler/
23

You might also like