How to set up C++ in Visual Studio Code

preview_player
Показать описание
How to set up C++ with Visual Studio Code (vscode).

Steps to setup minGW in windows:

2. Open MSYS2, enter the follow command:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain

3. Hit Enter for default selection, then type Y and hit Enter to proceed with the installation.

4. In your search bar, look for edit Environment Variables and open the setting. In the window bottom right, click Environment Variables. Click on Path in your list of User Variables. Click edit, new, add the following:

C:\msys64\ucrt64\bin

5. In your seach bar, look for Command Prompt and open it. Type in gcc --version, g++ --version, and gdb -- version. You should see minGW setup correctly.

Open vscode, and in extensions, look for C/C++ Extension Pack and install it. Then, create a new text file. Name it whatever you want, but be sure to include the .cpp extension.

On the top right, click on the play button to run your program. Select Run C/C++ File. You should now see your output display in the built-in terminal of VS Code!

And, there you have it! How to setup C++ for Visual Studio Code!

C++ Programming Playlist:

Java Game Programming Projects Playlist:

JavaScript Game Programming Projects Playlist:

Subscribe for more coding tutorials 😄!
Рекомендации по теме
Комментарии
Автор

Hey everyone if g++ or the other compilers aren't showing up at 06:08 time in the video or when you try to run the code (which is what happened to me every single time I tried this) this sounds so dumb but just make sure you did all the previous steps correct and RESTART YOUR COMPUTER. It worked for me after this. Thanks Kenny Yip Coding for the tutorial and happy coding y'all :)

andrewbauman
Автор

i tried getting a compiler to work with vs code last year and couldn't figure it out and gave up. this method was super easy, straight to the point, and ive got a working compiler now thank you.

ziprock
Автор

Thanks a lot for the helpful guide! I know the steps are explained on the website but having someone to walk you through the process is a lot less stressful!

theironrhino
Автор

The only video I could find that actually explained this clearly. Subscribed just off the quality of this video alone. As soon as I have hello worlded I'll be back to see what else you've got.

alexwade
Автор

Thank you. My cmd line test didnt work at 3:57 but it worked in the MYSYS2 cmd line. This solved my issue with not having a compiler.

nckitsx
Автор

BRO, THANK YOU SO MUCH! YOU ARE AWESOME! I was suffering the whole day, and can't understand why VSCode is not working i swear i felt like I'd been all over the internet to find something about my problem BUT you're video help me. Thank you again pal!!!

llpfqxd
Автор

The only tutorial that actually worked for me! Thank you!!

Dulkage
Автор

I love you. I have spend AGES doing this and this finally worked.

christiangiamalis
Автор

This never works for me. It's like the world doesn't want me using vs code for c++, I followed this tutorial step by step, watched the video three times, and it still failed.

taongaphiri
Автор

You dude is a hero! Let me add that the first time you run your code after you do this, there'll be a bunch of errors. Depending on how fast your computer is, it will take time before all the scripts load up and be read in your computer's system. Mine had a bunch of error at first when I ran my codes and I just restarted my laptop and it eventually worked.

ericroque
Автор

As someone who is a complete beginner, THIS IS THE MOST USEFUL VIDEO I HAVE EVER COME ACROSS, THE ONLY VIDEO THAT HELPED. Thankyou so much honestly. 🔥

Amy_k
Автор

I've been looking for a video like this. I always struggle to compile but now, it's not a problem. Thank you!

fardinkhandaker
Автор

thank you bro I installed g++ and couldn't know why it wasn't working you're a life saver ❤❤

WickedDev
Автор

Thank you, I've been using online gdb for the longest, but just having the choice of vs code makes me happy. Make sure to restart the computer afterwards as well since it wasn't working until after.

Bruh-pyhk
Автор

3:40 - For those who get the error "gcc is not recognized as an internal or external command", close the terminal and open the command prompt again but run as administrator.
EDIT: It might not work instantly, you might as well reboot the system first.

awenixmusic
Автор

the simpilest and the easiest tutorial of running c++. Thanks alot

fahad
Автор

Thank you so much! A try a lot of videos and always struggeles in running C and C++ code . Regards👏💯

softwareengineer
Автор

trying since yest but finally able to run my prog with help of the clear instructions you have provided on this video, Thank You !

iam-shreyasingh
Автор

I done installation within few minutes.I've been looking for a video like this.thanks a lot!!

HARIPRIYASRIPERAMBUDURU
Автор

It was really a helpful video. It shows the exact procedure line by line. Thanks a lot.

MahiAhmed_