vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Debug Button Doesn't Work

Open Tabrizian opened this issue 5 years ago • 6 comments
trafficstars

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

Tabrizian avatar Aug 17 '20 21:08 Tabrizian

I'm also getting this when running via SSH to a remote machine:

target_name_undefined

Any insight would be appreciated!

definelicht avatar Jan 28 '21 16:01 definelicht

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.

andreeis avatar Jan 28 '21 18:01 andreeis

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.

definelicht avatar Jan 29 '21 09:01 definelicht

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.

andreeis avatar Jan 29 '21 16:01 andreeis

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 😂.

paleomoon avatar Nov 19 '21 11:11 paleomoon

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.

maximilianmordig avatar Aug 22 '22 11:08 maximilianmordig

on my case, this happened when CMakePresets.json has no cacheVariables::CMAKE_BUILD_TYPE

Eveheeero avatar Jan 28 '23 17:01 Eveheeero

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.

gcampbell-msft avatar Jul 06 '23 18:07 gcampbell-msft

For me, CMake: Reset Cmake Tools Extension State (For troubleshooting) works.

cyfex avatar Aug 11 '23 08:08 cyfex