By the end of this guide, you’d be able to run, debug, and get IntelliSense for C/C++ files in VSCode. Though, this guide is focused on the Windows platform but can be extended to Mac and Linux with some minor changes. I extensively used C & C++ in my years and wanted better support for debugging & IntelliSense. The only options available were (outdated) and the original "Mammoth" Visual Studio. Lately, I found VSCode and fell in love with it (first love was Atom). I tweaked it around and set it up as a complete IDE For small C, C++ projects especially geared towards competitive programming. competitive programming Dev-C++ Create a sample C/C++ project 1. Open/Create an empty folder in VSCode. 2. Create a file inside it like below: new.cpp ; { << << ; ; } # include <iostream> using namespace std int main () cout "Hello World" endl // uncomment below line to stop cmd from exiting immediately in case of "externalConsole": true //system("pause"); return 0 3. Install C/C++ extension in VSCode and reload. recommended Official C/C++ Extension for VSCode Install C/C++ Compiler C/C++ extension a C++ compiler. So, you will need to install one or use which is already installed on your computer. does not include Download (latest release) and extract it to the C Drive. Windows: MinGW64.zip Mac: XCode Linux: GCC Also, Make sure to add C++ compiler PATH to environment variable of your platform. For Windows MinGW64 add: C:\MinGW64\bin Run and Debug C/C++ Code You’ll notice that there is also a folder in your sample project. To configure , 2 files are required and inside folder. .vscode debug configuration launch.json tasks.json .vscode VSCode can create and auto-configure these files if we try to debug for the first time. To do that, open C++ file in VSCode and either hit or go to and select then select . F5 Debug -> Start Debugging C++ (GDB/LLDB) g++.exe build and debug active file Select C++ (GDB/LLDB) Select g++.exe build and debug active file This should create 2 files and in folder which should look like below (update the MinGW64 path if not correct) launch.json tasks.json .vscode Notice that I’ve added one more optional configuration in and in file for purpose of also . Now you may choose which configuration to pick when you start debugging. You may remove the configuration whichever you won’t need. g++ build & run active file launch.json g++ build & run tasks.json Running C/C++ code without debugging Run & Debug or Only run code launch.json: { : , : [ { : , : , : , : , : [], : , : , : [], : , //set to true to see output in cmd instead : , : , : [ { : , : , : } ], : }, { : , : , : , : , : [], : , : , : [], : , //set to true to see output in cmd instead : , : , : [ { : , : , : } ], : } } "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" "C:\\MinGW64\\bin\\gdb.exe" "setupCommands" "description" "Enable pretty-printing for gdb" "text" "-enable-pretty-printing" "ignoreFailures" true "preLaunchTask" "g++.exe build active file" "name" "g++ build & run active file" "type" "cppdbg" "request" "launch" "program" "${fileDirname}\\${fileBasenameNoExtension}.exe" "args" "stopAtEntry" false "cwd" "${workspaceFolder}" "environment" "externalConsole" false "MIMode" "gdb" "miDebuggerPath" "C:\\MinGW64\\bin\\gdb.exe" "setupCommands" "description" "Enable pretty-printing for gdb" "text" "-enable-pretty-printing" "ignoreFailures" true "preLaunchTask" "g++ build & run active file" tasks.json { : [ { : , : ;, : ;, : [ , , , ];, : { : } }, { : , : , : , : [ , , ], : { : } } ], : } "tasks" "type" "shell" "label" "g++.exe build active file" "command" "C:\\MinGW64\\bin\\g++.exe" "args" "-g" "${file}" "-o" "${fileDirname}\\${fileBasenameNoExtension}.exe" "options" "cwd" "C:\\MinGW64\\bin" "type" "shell" "label" "g++ build & run active file" "command" "C:\\MinGW64\\bin\\g++.exe" "args" "${file}" "-o" "${fileDirname}\\${fileBasenameNoExtension}.exe" "options" "cwd" "C:\\MinGW64\\bin" "version" `externalConsole` in `launch.json` can be set to true to see code output in cmd instead. to take effects of newly added compiler paths. Restart VSCode Open any C/C++ file, set some breakpoints (or not), and hit the Big Green Play Button. (Shortcut to debug: F5 ) Select g++.exe build and debug active file : To hide files in the side explorer of VSCode, open settings and paste the below config: Tip *.exe : { : } "files.exclude" "*.exe" true