- ms-vscode.cpptools-extension-pack (https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack)
- https://sourceforge.net/projects/mingw/
- mingw32-base
- mingw32-gcc-g++
- set environment variable to bin path C:\MinGW\bin\
| #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 | |
| } | |
| } | |
| ] | |
| } |