Today, I want to show how to install visual studio code for C++ IDE.
My OS is Windows 10.
The reason why I choose Visual Studio Code is because it is open-source and fast interface.
We need to install software and build environment path but it is not so hard!
Then, let's start!

1. Install Visual Studio Code
Install Visual Studio Code this link(Download Visual Studio Code - Mac, Linux, Windows)
Download Visual Studio Code - Mac, Linux, Windows
Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.
code.visualstudio.com
If you install Visual Studio Code, now we need to install extension for C++.
I installed "C/C++" and "C/C++ Extension Pack" Extensions. The Extension window is located here.
If you still don't know how to install exntesion, please check this link.(Managing Extensions in Visual Studio Code)
Managing Extensions in Visual Studio Code
Discover, add, update, disable and uninstall Visual Studio Code extensions (plug-ins) through the Extension Marketplace.
code.visualstudio.com
You might need to install SDK too. Here is link for SDK for Visual Studio Code (Download .NET SDK for Visual Studio Code (microsoft.com))
Download .NET SDK for Visual Studio Code
Download and install the .NET SDK for building .NET apps with Visual Studio Code on Linux, macOS, or Windows.
dotnet.microsoft.com
2. Install a compiler
We also need to install a compiler. C++ is a compiled language so we must complie before it can be run in your machine. Unfortunately, VS code is an editor and does not include a C++ compiler or debugger. Therefore, you need to install a compiler additionally.
But, maybe you already have a compiler. Check if you have a compiler.
Please open Command Prompt in your machine and write this command.
This command is to check for the GCC compiler:
g++ --version
If you can see g++ version like below, you have already a compiler.
If you don't have any compiler, I recommend to you to install MinGW-x64 via MSYS2. The MSYS2 link is here(MSYS2)
MSYS2
Software Distribution and Building Platform for Windows
www.msys2.org
After you install MSYS2, please Run MSYS2 terminal. You need to install the full Mingw-w64 toolchain. So please write this command in MSYS2 terminal.
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
If you install all toolchain, now you need to add the MinGW compiler to your environment PATH.
Please follow these steps.
1. open Windows settings.
2. search for Edit environment variables for your account.
3. Choose the Path variable in your User variables and then select Edit.
4. add your mingw-w64 installed path into Path. If you don't change any installation path, it should be C:\msys64\mingw64\bin.
5. Select OK.
Now, we can check your MinGW compiler.
Please open Command Prompt in your machine and write this command.
gcc --version
g++ --version
gdb --version
If you can see all version, you succeed to install MinGW.
But if you cannot see all, please check your PATH correct and C:\msys64\mingw64\bin folder has files. If you don't have files in C:\msys64\mingw64\bin folder, you need to install full Mingw-w64 toolchain again.
3. Run Hello World
So now, we need to check the compiler is working fine.
Let's open VS code and create a folder HelloWord and create helloworld.cpp file.
I just created one more parent folder "C++". But it doesn't matter!
Now, please paste this script into your source code(helloworld.cpp) and save source code:
#include <iostream>
int main()
{
std::cout << "Hello World" << std::endl;
}
Now, we need to build source code first as I explained above. Select the Terminal → Run Build Task from the main menu.
There are several build options. But we choose C/C++: g++.exe build active file option.
If your build finished successfully, you can see an executable file called helloworld.exe in File Explorer.
To run helloworld.exe, please open new terminal in VS code.
run your program by typing ".\helloworld.exe" in your terminal. If everything is fine, you should see the output "Hello World".
So today, we learn how to install visual studio code for C++.
If you have any question, please write a comment.