Debug doesn't set MIDebuggerPath
The CMake Tools plugin works for the most part after selecting the environment (the "Working in..." part in bottom right). It correctly builds everything when I select MinGW. However, if I try to select Debug, using the default CMake Tools debugging options, I get the following message:
Unable to start debugging. Launch options string provided by the project system is invalid. Unable to determine path to debugger. Please specify the "MIDebuggerPath" option.
If the MIDebuggerPath was set to the environment (ie. the activeEnvironments in .cmaketools.json plus the expected debugger, (ie. bin/gdb), manual creation of the launch.json would not be required.
For example, my present MinGW environment is as follows in .cmaketools.json:
"activeEnvironments": [
"MinGW - C:/Program Files (x86)/mingw-w64/i686-7.2.0-posix-dwarf-rt_v5-rev0/mingw32"
],
It would be nice if the CMake Tools was smart enough to set MIDebuggerPath to:
C:/Program Files (x86)/mingw-w64/i686-7.2.0-posix-dwarf-rt_v5-rev0/mingw32/bin/gdb
Try this:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch CMake-built program",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.debugTarget}",
"stopAtEntry": true,
"cwd": "${workspaceRoot}"
}
]
}
This should work in the next version. the gdb path is generated out of the c compiler/ cxx compiler from cmake cache.
If it does not work like expected then reopen it.