向c++程序传递参数以便在VSCode中调试
visual studio code - Passing arguments to C++ programme for debugging in VSCode
我想调试VSCode中的c++项目(在Mac上,使用GDB或LLDB)。程序本身接受命令行参数,如
./prog -input cf file_x.txt
当在命令行上启动GDB中的调试会话时,这很好。
在VSCode中,我试图使launch.json
读成这样(只显示相关行):
"program": "${workspaceRoot}/build/prog",
"args": [
"-input cf",
"path_to/file_x.txt"
]
这样,我在输出中得到@"Unknown option: "-input cf"rn"
,并且未调试该过程;或者,我只尝试了一个参数,像这样:
"program": "${workspaceRoot}/build/prog",
"args": [
"-input cf path_to/file_x.txt"
]
产生相同的消息。我错过了什么重要的事情吗?
像这样试试
"program": "${workspaceRoot}/build/prog",
"args": [
"-input",
"cf",
"path_to/file_x.txt"
]
2022年,我只做:
"args": [
"your_arg1",
"your_arg2"
]
(在启动。Json)
相关文章:
- 当回溯以零开始时,如何调试崩溃
- 使用vscode调试时,GDB意外退出
- 如何在添加文件的情况下在VSCode中调试C++程序
- 如何在 VsCode 上调试 C++/C 程序
- 无法在VSCode中设置C++调试;无法识别调试类型
- VSCode C++调试文件名中包含中文字符的文件时插件损坏
- 在集成终端上运行vscode lldb调试器时,如何获取程序的输出?
- 如何修复使用VScode调试器gcc调试时的"找不到文件"错误
- 如果您在C++上有 Makefile 项目,如何在 VScode 中"fix"调试器?
- VSCode:调试时无法打开镜像(C++/SFML)
- 如何在VSCode上使用MSYS2(MSYS64)gdb.exe调试C++
- VSCode C++调试捕获控制台输出
- 从VSCODE C 调试步骤中排除文件
- 使用GCC,G 和GDB在窗口7上设置C/C 调试的VSCODE
- Vscode C++调试使用 cl.exe 和 / 链接构建的代码.exe - 调试器不附加
- 如何使用lldb和VSCode保持调试器的活动,以将其与bitcoind和bitcoin-cli一起使用?
- 如何使用VSCode调试C++应用程序控制台应用程序
- 如何在 VSCODE 中使用"sudo"调试程序
- Visual Studio Code VSCode调试/编译c++
- 向c++程序传递参数以便在VSCode中调试