1. Download and install Visual Studio Code from https://code.visualstudio.
com/
2. Install a compiler (MinGW-x64)
- Download MinGW from https://github.com/msys2/msys2-installer/releases/download/2022-06-
03/msys2-x86_64-20220603.exe
- Install the full Mingw-w64 toolchain (pacman -S --needed base-devel mingw-w64-x86_64-
toolchain)
- Add the path to your Mingw-w64 bin folder to the Windows Path environment variable.
- Check your MinGW installation
(g++ --version, gcc –version, gdb –vesion)
3. Install the extension for C/ C++
- Open VS Code
- Select the Extensions view icon on the Activity bar
- Search for 'C++'
- Select C/C++
- Click ‘Install’
4. Running a simple Hello World C++ program
- Click ‘Open Folder’
- Select the folder you created (eg: Workspace_C++)
- Click ‘Yes, I trust the authors’
- Click New File icon and give the name ‘helloworld.cpp’
- Write these lines
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World";
return 0;
}
- Click ‘Run Build Task’ from Terminal menu (or) Run C/C++ file icon on the bar.
- Choose ‘C/C++, g++.exe build and debug active file’
- Click ‘Run C/C++ file’ icon on the bar
(or)
- From a new VS Code Integrated Terminal, you can now run your program by typing ".\
helloworld".