Skip to content

Instantly share code, notes, and snippets.

@MarioBinder
Last active April 14, 2021 18:49
Show Gist options
  • Save MarioBinder/8c4d63dea27078fff811c301d504dc0a to your computer and use it in GitHub Desktop.
Save MarioBinder/8c4d63dea27078fff811c301d504dc0a to your computer and use it in GitHub Desktop.
C++ with VSCode
#include<stdio.h>
int main() {
printf("Hello Mario C World from VS Code and the C/C++ extension!\n");
return 0;
}
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello Mario", "C++", "World", "from", "VS Code", "and the C/C++ extension!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
}
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file" //should be the same of label in tasks.json
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe build active file",
"command": "g++.exe",
"args": ["-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe"], //current open file
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment