0

I downloaded MingGW x64 as specified here: https://code.visualstudio.com/docs/languages/cpp then added C:\msys64\mingw64\bin to path

When opening the MSYS2 MINGW x64 app from the start button and checking the version, it seems to be working fine:

$ g++ --version
g++.exe (Rev3, Built by MSYS2 project) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

However, I'd like to include this into my visual studio workflow, but when checking for the compiler in the VS terminal, I get an error:

>>g++ --version
g++ : The term 'g++' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ g++ --version
+ ~~~
    + CategoryInfo          : ObjectNotFound: (g++:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

what could this be?

drescherjm
  • 10,365
  • 5
  • 44
  • 64
gmut
  • 7
  • 3
  • Is what you are using really Visual Studio, not Visual Studio Code? – MikeCAT Jul 11 '22 at 12:54
  • 2
    VS Code and Visual Studio are two completely unrelated products. – Captain Giraffe Jul 11 '22 at 12:54
  • Hi, I double checked and I am using Microsoft Visual Studio – gmut Jul 11 '22 at 12:55
  • The link you provided is for Visual Studio Code. For Visual Studio you probably want to use the included compiler. – Captain Giraffe Jul 11 '22 at 12:56
  • You really have to wonder why MS have two unrelated products called Visual Studio and Visual Studio Code. – john Jul 11 '22 at 13:03
  • @gmut. If it's not already installed you should use the Visual Studio Installer to install the 'Desktop development with C++' module. That's all you need to write C++ programs in Visual Studio. – john Jul 11 '22 at 13:05
  • Oh jezus, @CaptainGiraffe is completely right. I think it's time for a break.. Yes, it turned out that when I installed the desktop development with C++, the compiler box was unchecked, so I installed that just now. Thanks for the help! – gmut Jul 11 '22 at 13:15
  • 1
    Visual Studio comes with the Microsoft Compiler. Why are you trying to make it use a different compiler? I recommend using the command line version of the other compiler. Otherwise, verify that you are using the Visual Studio **Code** IDE. – Thomas Matthews Jul 11 '22 at 14:57
  • [DUPE](https://stackoverflow.com/questions/72631907/cpp-files-not-running-in-vs-code) – Jason Jul 11 '22 at 15:54

0 Answers0