I've already installed g++, gdb, and make via MSYS2. (See the first picture)
However, when I click CMake: Configure in VS Code, I can't see the GCC compiler, but only what the last picture shows.
According to the CMake Extension author's video below (at 1:06), I should be able to see GCC compiler:
https://youtu.be/wP4cwAtU-g8?t=66
So, how can I use GCC compiler?
Thanks!



You need to add your GCC/G++ location to your cmake-kits.json
I've installed vs code like 30 minutes ago, after this video from CppCon
And currently I'm trying to do the same thing as you - add GCC compiler to VSCode on my work PC, I've installed mingw-w64 and add path to gcc in cmake-kits.json
{
"name" : "MinGW-w64-GCC",
"compilers": {
"CXX": "C:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/g++.exe",
"C": "C:/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe"
}
},
...
then restart vs_code and now I can select GCC compiler

But as soon as I'm trying to build (> Cmake: Build) quick start project (> Cmake: Quick Start) I'm getting error:
Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json or your Kit configuration.
What you did reminded me to Scan for Kits.
I didn't use your method. Instead I used the command "CMake: Scan for Kits".
After that I can select GCC compiler as well when click "CMake: Configure".


However now my problem is when I run "CMake: Configure" using GCC compiler, the following error occurs, different than your error:

Finally, cmake-tool can detect my GCC compiler after I've added migw-w64 to the PATH environment variable.
Maybe it will help you.
But I'm still getting two erros:
Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json or your Kit configuration.Unhandled exception: Unhandled Promise rejection: build Error: Impossible: CMake driver died immediately after successful configure {}@SolarJuice what is the path to your CMake executable on your machine?
@NovaSurfer I'd defer to the issues you linked. These ones have been persistent and I'm still investigating just what is happening since those errors can appear for a variety of reasons.
i got same error。。。need help!
@grays820 which of the above errors are you seeing?
I too am having this issue, scanning for kits properly finds my gcc-8.2.1 installation from MSYS2, but when actually selecting the kit it throws an unhandled exception
[rollbar] Unhandled exception: Unhandled Promise rejection: selectKit Error {}
MSys2 is currently not supported by "Scan for kits". But you can create your own kit.
The important part is the enviromentVariable.
{
"name": "GCC 7.4.0",
"compilers": {
"C": "C:\\msys64\\usr\\bin\\gcc.exe",
"CXX": "C:\\msys64\\usr\\bin\\g++.exe"
},
"preferredGenerator": {
"name": "Makefiles"
},
"environmentVariables": {
"PATH": "${env:PATH};C:\\msys64\\usr\\bin"
}
}
Where did you install cmake? Inside of Msys2 or the windows version?
windows version
im using a compiler installed through msys not the built-in mingw compiler used by msys.
This issue is being closed because it appears to have been abandoned. If @KoeMai's fix did not address this, or if you require further assistance, please let us know and we can reopen it.
Most helpful comment
MSys2 is currently not supported by "Scan for kits". But you can create your own kit.
The important part is the
enviromentVariable.{ "name": "GCC 7.4.0", "compilers": { "C": "C:\\msys64\\usr\\bin\\gcc.exe", "CXX": "C:\\msys64\\usr\\bin\\g++.exe" }, "preferredGenerator": { "name": "Makefiles" }, "environmentVariables": { "PATH": "${env:PATH};C:\\msys64\\usr\\bin" } }Where did you install cmake? Inside of Msys2 or the windows version?