Hi all,
I am pretty new to the VScode and CMkake tools. My project is configured and generated by Cmake. Then, the VScode with Cmake tools integrated is employed to debug the project function. My main.cpp file has a main function like this:
int main(int argc, char** argv)
{
......
}
So I try to add the parameters directly to the launch.json (parameters are added to the bracket after "args: " ):
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"build/glidar",
"models/itokawa.ply",
"-- scale 1",
"--model-dr 0,0,0",
"--model-r 0,50,30,1",
"--camera-z 800",
"-w 768",
"-h 768",
"--fov 20"
],
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/out/**/*.js"
],
"preLaunchTask": "npm"
}
]
}
But it didn't work.
Hi, @mingliangfu, I'm sorry this took so long to hear from me. I've been busy recently with the holidays and new year rolling around.
~Are you using target debugging? In that case, the debug configuration goes in settings.json, as described here. Using target debugging and the Debug button provided by CMake tools will not make use of the content of launch.json.~
~Does this help? If not, feel free to ask any follow up questions. Thanks!~
For those reading this: Please use the launch.json integration described here instead
Due to lack of follow-up, I feel that I must close this issue.
Feel free to reopen to restart the discussion
Hi @vector-of-bool
I was pretty confused at first just like the OP, trying to figure out why program argument wasn't actually passed. And then I found out there is a difference between CMake Tools debug button and the built-in debug button. Because as stated in the documentation, the quick debugging button provided by CMake Tools does not pass program arguments. But can it be made to support passing arguments too?
Hello! While it's _possible_ using settings.json, it is extremely fragile and I really don't like it. I'm looking into removing the option of using settings.json in this way in the future and deferring to the launch.json integration, which is actually easier and more powerful.
Most helpful comment
Hi, @mingliangfu, I'm sorry this took so long to hear from me. I've been busy recently with the holidays and new year rolling around.
~Are you using target debugging? In that case, the debug configuration goes in
settings.json, as described here. Using target debugging and theDebugbutton provided by CMake tools will not make use of the content oflaunch.json.~~Does this help? If not, feel free to ask any follow up questions. Thanks!~
EDIT:
For those reading this: Please use the
launch.jsonintegration described here instead