Setup C++ in VS Code (Windows 2024)
Sujal Agre
Posted on August 10, 2024
This blog post will guide you to install C++ in Windows for VS Code
Step 1: Installing VS Code
- Download the latest VS Code Setup.exe from this link.
- Click on I Accept the agreement and click on Next
- Make sure to check all the boxes as shown below and click Next.
- Click on Install and wait till its installed.
- Click on finish.
Step 2: Installing Required Extensions in VS Code.
- Go to the Extensions Tab (Ctrl+Shift+X) in VS Code.
- Search up and Install the following Extensions.
Step 3: Installing C++ Compiler.
Installing the MinGW-w64 toolchain
Get the latest version of MinGW-w64 via MSYS2, which provides up-to-date native builds of GCC, MinGW-w64, and other helpful C++ tools and libraries. This will provide you with the necessary tools to compile your code, debug it, and configure it to work with IntelliSense.
- You can download the latest installer from the MSYS2 page or use this direct link to the installer and open it.
- Install it with default settings and check the run MSYS2 now box at the finish page and click finish.
In this terminal install MINGW64 by running this command and press enter.
pacman -Syu
thentype Y
to proceed with the installation.
and then typeY
once again to update confirm all the MSYS2 Processes.Type this command line
pacman -Su
and press enter. TypeY
and enter to proceed with the installation.
Paste this command in the terminal.
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
and press enter.
then press enter again and typeY
to proceed with the installation.
Step 4: Adding bin to Windows PATH environment variable.
- Search
Edit environment variables for your account
and open it. - Select
PATH
and click on Edit. - Click on new and enter your path to
bin
folder. If you used the default settings above, then this will be the path:C:\msys64\ucrt64\bin
Step 5: Check your MinGW Installation.
To check that your MinGW-w64
tools are correctly installed and available, open a Command Prompt and type:
gcc --version
g++ --version
gdb --version
If MinGW is installed correctly you should see the version of your installation.
That's It, you have successfully installed MinGW and C++ for VS Code.
Posted on August 10, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024