VS code C语言调试提示:lanch:program‘E:\develop\Visual Stodio Code\a.exe'does not exit

大佬们:刚装的环境 学习C语言 代码示例调试时提示:lanch:program‘E:\develop\Visual Stodio Code\a.exe'does not exit。调了半天,请大佬们指出问题在哪?

程序代码

 #include <stdio.h>
int g_var=0;
void print_line(char *str)
{
    if(str!=NULL)
    printf("%s\r\n",str);
    else
    printf("null string\r\n");
      }
    int main(int argc, char const *argv[])
    {
        int l_var=1;
        print_line("hello world");
        printf("g_var=%d,l_var=%d.\r\n",g_var,l_var);
        return 0;
    }

takks.json

 {
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "command": "gcc",
    "args": [
        "-g",
        "${file}",
        "-o",
        "${workspaceRoot}/hello.exe"
    ],
    "problemMatcher": {
        "owner": "cpp",
        "fileLocation": ["relative", "${workspaceRoot}"],
        "pattern": {
            "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "severity": 4,
            "message": 5
        }    
    }
    }

lanuch.json

 {
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/a.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "/path/to/gdb.exe",// "miDebuggerPath": "/path/to/gdb"
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": false// "ignoreFailures": true
                }
            ],
            "preLaunchTask": "gcc",//原来没有
        }
    ]

1个回答

可能是win10自带的windows defender将编译器生成的文件当成病毒自动处理了。可以去通知中心看一下

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!