I am trying to run a program on VSCode c++ compiler by Microsoft, but there is no launch.json file being created by default when I am trying to debug by the compiler, it only created tasks.json file in the .vscode folder. Whenever I am debugging an error is showing namely- 'The preLaunchTask 'C/C++:gcc.exe build active file' terminated with exit code -1' and an option shows to debug anyways.
My code- abacaba.cpp:
#include <iostream>
using namespace std;
int main(){
int x;
cin >> x;
cout << "The number is" << x;
return 0;
}
My tasks.json file:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\Program Files (x86)\\mingw64\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${fileDirname}\\*.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}