- g++ (by installation of the development package
build-essential
) - C/C++ Extension
- CodeLLDB Extension
Step 1: Edit launch.json
file
{
"version": "0.2.0",
"configurations": [
{
"name": "lldb launch",
"type": "lldb",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"preLaunchTask": "C/C++: g++ build active file"
}
]
}
Step 2: Edit tasks.json
file
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-std=c++17",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
]
}
Step 3: Create and edit main.cpp
file
#include <iostream>
#include <vector>
using namespace std;
int main(){
string s = "Hello World";
vector<int> v = {0, 1, 2, 3};
for(auto item: v){
cout << "Hello World " << item << endl;
}
return 0;
}
Step 4: Run & Debug
Click Run & Debug (Ctrl+Shift+D), then click Start Debugging (F5)