undefinedfix
Sign in

Vscode debugging C program prompt unable to perform this action because?

rdkdh edited in Wed, 25 Jan 2023

I use vscode + WSL to match the C development environment, according to the online said with good launch.json and tasks.json , launch.json If the value of externalconsole is true, why don't you pop up the debug box as mentioned on the Internet, but still input and output the debug console at the bottom? launch.json :

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "gcc - 生成和调试文件",
            "type": "cppdbg",
            "request": "launch",
            //编译完成的可执行文件
            "program": "/mnt/e/Code/CTest/${fileBasenameNoExtension}.o",
            //"args": ["-fThreading"],
            "args": [],
            "stopAtEntry": false,
            //项目所在目录
            "cwd": "/mnt/e/Code/CTest",
            "environment": [],
            "externalConsole": true,
            //调试时跳转到内部调试台
            //"internalConsoleOptions": "openOnSessionStart",
            //启动前的预执行任务要与tasks.json中label一致
            "preLaunchTask": "gcc 编译文件",
            "windows": {
                "MIMode": "gdb",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            },
            "pipeTransport": {
                "pipeCwd": "",
                "pipeProgram": "c:\\windows\\sysnative\\bash.exe",//通常不需要修改
                "pipeArgs": ["-c"],
                "debuggerPath": "/usr/bin/gdb"
            },
            "sourceFileMap": {
                "/mnt/e": "E:\\"//地址转换
            }
        }
    ]
}
0 Replies