[如何在使用VSCode调试任何程序时提供参数,并且接受--x“ value”之类的参数?

问题描述 投票:0回答:1

必须在launch.json文件中提供参数。有一个称为args的字段,将传递参数。如果您必须传递-x'value'或--y = false或--z之类的参数,请编辑launch.json并在arg文件中添加如下所示的参数-

        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "path of the exe",
            "args": [ "--x", "value" ,"--y=false", "--z"],
            "stopAtEntry": false,
            "cwd":  "current working directory",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
        }
debugging visual-studio-code arguments launch
1个回答
0
投票

必须在launch.json文件中提供参数。有一个称为args的字段,将传递参数。如果您必须传递-x'value'或--y = false或--z之类的参数,请编辑launch.json并在arg文件中添加如下所示的参数-

        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "path of the exe",
            "args": [ "--x", "value" ,"--y=false", "--z"],
            "stopAtEntry": false,
            "cwd":  "current working directory",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
        }
© www.soinside.com 2019 - 2024. All rights reserved.