Reputation: 733
I'd like to give VSCode a try. Is it possible to set compile and build commands for all .cpp files? Just like in Geany? And it is possible to do that for every supported language?
Searching here and there it seems that I have to set it in task.json for each project (even the link to iostream)
Upvotes: 3
Views: 2971
Reputation: 182
launch.json
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "Example:/Your/path/to/gdb",
"preLaunchTask": "g++",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
tasks.json
{
"version": "2.0.0",
"command": "g++",
"args": [
"-g",
"${file}",
"-o",
"${fileBasenameNoExtension}.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 }
}
}
That's the solution for C/C++ Extension. Maybe you have to set a breakpoint at the end of the .cpp file. Or you can install the code-runner Extension. You can add the two files to C:/Users/someone/AppData/Roming/Code/User/ so that you can compile for all .cpp files.
Upvotes: 1
Reputation: 733
From here: https://github.com/Microsoft/vscode/issues/1435#issuecomment-433324050
Global tasks in a task.json file are still on the agenda (to get parity with launch.json). However it is a matter of priorities when they will come.
So the answer is: not yet.
Upvotes: 0