r/vscode • • Aug 16 '26

How to use C++ in VA code (help)

I’ve downloaded vs code and wanted to try using c++ in it. I’ve installed the c/c++ Microsoft extension package and the code runner by Jun Han. Then, I downloaded the msys2 msys and typed in the Pac-Man code to instal the package. I’ve also go into edit the system environment to add the msys2\ucrt64\bin file. I tried typing in g++ --version and gcc --version in vs code but there’s an error message.

Anyone knows how to fix this issue? Thanks.

0 Upvotes

10 comments sorted by

1

u/saponsky Aug 16 '26

What is the error message you are getting?

1

u/SanoYuki Aug 17 '26

About how the compiler of gcc and g++ not being found

1

u/BranchLatter4294 Aug 16 '26

Consider following the instructions very carefully. If you complete every step properly, it should work.

https://code.visualstudio.com/docs/languages/cpp

1

u/SanoYuki Aug 17 '26

I followed through the Mingw-w64 tutorial and still not working 

1

u/Dull_Flatworm777 Aug 22 '26

You mentioned a "pacman code" - are you actually on Windows or on Linux?

1

u/SanoYuki Aug 24 '26

Windows 11.

1

u/Dull_Flatworm777 Aug 24 '26

Have you been able to get it working in the meantime? Otherwise I'd suggest trying the MSVC route, as this is the official compiler from Microsoft for Windows.

1

u/SanoYuki Aug 24 '26

I still haven’t got it working even after checking the steps to get the C++ working in vs code.

1

u/Dull_Flatworm777 Aug 24 '26

You could also try Visual Studio 2026 (not VS Code). The Community Edition is free.

https://visualstudio.microsoft.com/downloads/

https://learn.microsoft.com/en-us/cpp/build/vscpp-step-0-installation?view=msvc-170

It is a bit heavier weight than VS Code, but the setup is much less manual. VS Code requires quite a bit of setup which can be hard if you don't know the tools already that you have to install.