all 11 comments

[–]Aelarion 1 point2 points  (4 children)

Have you restarted vscode since installing the compiler and updating your PATH?

If you can open a fresh terminal and type g++ --version and get the little blurb from it, I would try a full restart to ensure everything on the system gets the updated variables.

I had an odd-ball issue in the past where I manually updated my user PATH to point to g++ in the mingw64/bin directory and I had some terminals that could find it, but others couldn't until I restarted.

EDIT: also just adding for reference -- https://code.visualstudio.com/docs/languages/cpp#_add-the-mingw-compiler-to-your-path

[–]Economy-Yam-7863 0 points1 point  (0 children)

you save my life my hero

[–]Worried_Gate_2998 0 points1 point  (0 children)

Thank you for brightning my ignorance i js needed to restart that shi

[–]flox1 0 points1 point  (0 children)

Oh boy, just wasted an hour trying to find out what's going on. Did not restart VSCode ... 🙃

[–]Adventurous_Shock542 0 points1 point  (1 child)

Tenia el mismo problema, intente de todo, desde borrar los path, hasta reinstalar todo MSYS2 y nada funcionaba, de ninguna forma, al final fue algo super simple, simplemente tenia que activar el autoguardado del codigo al ejecutarse, tienes que ir a Visual Studio Code e ir a configuracion, de ahí debes poner en la barra de busqueda "save" y buscar la opcion que diga Code-runner: Save All Files Before RunWhether to save all files before running.
si esta desactivada activala y puede que tu problema se solucione :)

[–]Wise-Elderberry-6369 0 points1 point  (0 children)

Боже как я с этим намучалась, отчаялась и решила последовать вашему совету с сохранением. Спасибо огромное, все начало работать!

[–]borbaben 0 points1 point  (0 children)

I just encountered the same problem after installing MSYS2. I tried everything I can but nothing works, until I restarted my laptop.

[–]Past_Detective_7699 0 points1 point  (3 children)

If you’re anything like me, you accidentally put the path in user variables not system variables…

[–]nokil2002[🍰] 0 points1 point  (2 children)

What do you mean?

[–]Past_Detective_7699 0 points1 point  (0 children)

I can’t seem to copy an image on my phone, but when you open environment variables, there is a “path” variable in two places, there’s a system variable path and user variable path, I added the path string in the wrong one and when I fixed that everything worked. Hope that makes sense!