Caution
A friendly reminder: The following tutorial is for Linux user instead of Windows
Tutorial
If you want to debug your c++ code with GDB
You can read this ( Debugging your code ) article from Visual Studio Code official website.
Step 1: Compilation
You need to set up task.json
for compilation of your cpp file
or simply type in the following command in the command window
g++ -g file.cpp -o file.exe
to generate a debuggable .exe
file
Step 2: Set up the launch.json
file
To enable debugging, you will need to generate a launch.json
file
follow the launch.json example or google others
Step 3: Press (Ctrl+F5) to start compiling
this launch.json
file will launch the configuration when you press the shortcut (Ctrl+F5)
Enjoy it!
ps. For those who want to set up tasks.json
, you can read this from vscode official (-> TypeScript Hello World)