Within .vscode,
Add some more compiler arguments (also called flags) to tasks.json.
{ "version": "2.0.0", "tasks": [ { "type": "shell", "label": "C/C++: g++ build active file", "command": "/usr/bin/g++", "args": [ "-pthread", "-g", //"${file}", "${workspaceFolder}/*.cpp", "-o", "${fileDirname}/${fileBasenameNoExtension}", "-Wall", "-Wextra", "-Wconversion", "-Wsign-conversion", "-Wshadow", "-Wpedantic", "-std=c++23" ], "options": { "cwd": "${workspaceFolder}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true } } ] }
NOTE:
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "g++ - Build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}/${fileBasenameNoExtension}", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "C/C++: g++ build active file", "miDebuggerPath": "/usr/bin/gdb" } ] }
NOTE: The string ${workspaceFolder} will automatically be replaced with the current workspace folder, so this will configure debugging sessions so that your program opens files from that folder.