Javokhir
Javokhir

Reputation: 31

VsCode while running c++ program

This is my launch.json file of VsCode :

{
"version": "0.2.0",
"configurations": [
    {
        "name": "C++ Launch (GDB)",                
        "type": "cppdbg",                         
        "request": "launch",                        
        "targetArchitecture": "x86",                
        "program": "${workspaceRoot}\\${fileBasename}.exe",                 
        "miDebuggerPath":"C:\\mingw-w64\\bin\\gdb.exe", 
        "args": [],     
        "stopAtEntry": false,                  
        "cwd": "${workspaceRoot}",                  
        "externalConsole": true,                  
        "preLaunchTask": "g++"                    
        }
]

} And this one if my tasks.json file :

{
"version": "2.0.0",
"tasks": [
    {
        "label": "<TASK_NAME>",
        "type": "shell",
        "command": "make",
        // use options.cwd property if the Makefile is not in the project root ${workspaceRoot} dir
        "options": {
            "cwd": "${workspaceRoot}/<DIR_WITH_MAKEFILE>"
        },
        // start the build without prompting for task selection, use "group": "build" otherwise
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "presentation": {
            "echo": true,
            "reveal": "always",
            "focus": false,
            "panel": "shared"
        },
        // arg passing example: in this case is executed make QUIET=0
        "args": ["QUIET=0"],
        // Use the standard less compilation problem matcher.
        "problemMatcher": {
            "owner": "cpp",
            "fileLocation": ["absolute"],
            "pattern": {
                "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                "file": 1,
                "line": 2,
                "column": 3,
                "severity": 4,
                "message": 5
            }
        }
    }
]}

They are worked before and today not. When I run task terminal shows this: and also it is building : and then when i debug (F5) program it is shows this :

Please help me how I run c++ program. Thanks for answers !

Upvotes: 1

Views: 306

Answers (1)

Alan Birtles
Alan Birtles

Reputation: 36614

You have configured a pre launch task called g++ but have no task of that name. You need to change the name of your build task to g++.

You just need to change the value of label to match the name of the task from tasks.json

Upvotes: 1

Related Questions