vscode-cmake-tools
vscode-cmake-tools copied to clipboard
Debug Button Doesn't Work
Brief Issue Summary
The debug button doesn't work in vscode-remote inside containers.
Expected:
Show a list of tragets to select for debug.
Apparent Behavior:
Show error message below:
Failed to prepare executable target with name 'undefined'
Platform and Versions
- Operating System:
- CMake Version: 3.18.1
- VSCode Version: 1.48.0
- CMake Tools Extension Version: 1.4.1
- Compiler/Toolchain: gcc7.5
I'm also getting this when running via SSH to a remote machine:

Any insight would be appreciated!
Thank you for opening this report. We will investigate why the quickPick with the launch targets is not automatically shown. One possible reason is a failed configure. Do you confirm that your project configures successfully?
In the meantime, you can specifically select a launch target via the command "CMake: Set Debug Target" in the pallette. Then hopefully the debug operation will work for you. Please let us know if this workaround works.
Manually configuring the debug target fixed the issue for me - thank you.
The project configured and built as expected when I experienced this issue, so I don't think the cause was a failed configure. Let me know what additional information I can provide.
Let us know if it happens again after you reload and don't manually configure anything. Make sure you don't have CMake.configureOnOpen set to false.
This happened when I made a mistake in CMakeList.txt: set(CMAKE_BUILD_TYPE DEBUG).
Change to set(CMAKE_BUILD_TYPE Debug) fixed the issue 😂.
I made it work by making sure that it is Debug rather than DEBUG, (setting "cmake.loggingLevel": "debug" in .vscode/settings.json to get verbose logs), deleting <cmake_build_folder>/.cache, then reload vscode window, then run set debug target which asks me for the target, as expected.
on my case, this happened when CMakePresets.json has no cacheVariables::CMAKE_BUILD_TYPE
Closing this as it seems that the issue comes from when the CMAKE_BUILD_TYPE is incorrectly defined. Please let us know if it should be re-opened or revisited for any reason.
For me, CMake: Reset Cmake Tools Extension State (For troubleshooting) works.