Download VS Code here
Note: It will not work if your default terminal is Powershell. Make it "cmd" then it will work.
To change default terminal : Hit clt+shift+p->write:default terminal->change it to cmd.
{
"version": "2.0.0",
"tasks": [
{
"label": "Compile and run",
"type": "shell",
"command": "",
"args": [
"copy",
"\"${file}\"",
"${workspaceFolder}\\jspwTest.cpp",
"&&",
"g++",
"jspwTest.cpp",
"-o",
"jspwTest",
"&&",
"jspwTest",
"<",
"input.txt",
">",
"output.txt",
"&&",
"del",
"jspwTest.exe",
"&&",
"del",
"jspwTest.cpp"
],
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true,
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "compile",
"type": "shell",
"command": "g++",
"args": [
"-std=c++17",
"-o",
"${fileBasenameNoExtension}",
"${file}"
],
"group": {
"kind": "build",
"isDefault": false
}
},
{
"label": "compile and run",
"type": "shell",
"command": "g++ -std=c++17 -o ${fileBasenameNoExtension} ${file} && ./${fileBasenameNoExtension} < input.txt > output.txt",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}