Open CChuancey opened 1 year ago
Unfortunately, the "quick debugging" feature wasn't really designed for frequent switching between targets. The only way to do this today is to write a launch.json
file and create a launch configuration for each of your targets.
Unfortunately, the "quick debugging" feature wasn't really designed for frequent switching between targets. The only way to do this today is to write a
launch.json
file and create a launch configuration for each of your targets.
Thanks for the reply, I tried to add the launch.json file, but when I run the program through the run button provided by cmake-tools, the parameters are not passed to the corresponding target. My launch.json file is as follows:
{
"version": "0.2.0",
"configurations": [
{
"name": "test",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/examles/01_recv",
"args": [
"1",
"2"
],
"MIMode": "gdb",
"cwd": "${workspaceFolder}",
"preLaunchTask": ""
}
]
}
The run button provided by CMake Tools is not connected to launch.json
. VS Code has a UI around that. Click on the "run and debug" icon in the side bar to open it up. Your configurations from launch.json
should show up in the drop down control.
The run button provided by CMake Tools is not connected to
launch.json
. VS Code has a UI around that. Click on the "run and debug" icon in the side bar to open it up. Your configurations fromlaunch.json
should show up in the drop down control.
Thank you, I see. When I try to use this method to run the program, vscode has to start in the form of debug every time. Is there a way to configure it in launch.json
to only run without debugging?
Unfortunately, run without debugging is not available in the C++ extension yet. 😢 https://github.com/microsoft/vscode-cpptools/issues/1201 (you can add another 👍 to that issue). If run without debugging was your goal, I'm sorry I led you to a dead end.
CMake Tools's run button doesn't go through the C++ extension, but doesn't support target-specific configurations. While typing this I had an idea about how the implementation could look.
"cmake.debugConfig": {
"args": [], // default config for all debug/launch operations
"[<target-name>]" : {
"args": [ ... ]
// other config overrides for this target conforming to the 'debugConfig' setting spec
}
}
Thank you, this is what I want too.
any estimation on when this feature will be online? It could be very useful.
Related: #2370.
Related on Stack Overflow: In CMake Tools, how to have different args for launching different targets?
Originally posted by @bobbrow in https://github.com/microsoft/vscode-cmake-tools/issues/121#issuecomment-887070667