Error"launch:program<folder/file.out>does not exist" in vscode writing c++ in ubuntu

Viewed 71

I'm using the vscode in ubuntu to write and run c++ code.It works until today the error happens.Everytime I start the vscode and press ctrl+F5,it will show "executing task: g++"in termial but no response after that.

If I restart the debugger it will show"launch:programdoes not exist.

If I use g++ in termial to build the .out file then vscode will work,so I think there is something wrong in vscode when building.

launch.json:

    {
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/${fileBasenameNoExtension}.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "preLaunchTask": "build",  
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

tasks.json:

    {
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "g++",
            "args": ["-g", "-o", "-std=c++11", "${file}", "${fileBasenameNoExtension}.out"]
        }
     ],
     "kind": "build",                
     "isDefault": true
}
0 Answers
Related