Reputation: 218
I want to debug a C++ project in VSCode (on a Mac, using either GDB or LLDB). The program itself takes command line arguments like
./prog -input cf file_x.txt
This works fine when starting a debugging session in GDB on the command line.
In VSCode, I tried to adapt launch.json
to read like this (only relevant lines shown):
"program": "${workspaceRoot}/build/prog",
"args": [
"-input cf",
"path_to/file_x.txt"
]
With this, I get @"Unknown option: \"-input cf\"\r\n"
in the output and the process is not debugged; alternatively, I tried only one argument like so:
"program": "${workspaceRoot}/build/prog",
"args": [
"-input cf path_to/file_x.txt"
]
resulting in the same message. Have I missed something important?
Upvotes: 19
Views: 42066
Reputation: 31
In 2022, I just do :
"args": [
"your_arg1",
"your_arg2"
]
(in launch.json of course)
Upvotes: 1
Reputation: 35358
Try it like this
"program": "${workspaceRoot}/build/prog",
"args": [
"-input",
"cf",
"path_to/file_x.txt"
]
Upvotes: 30