VSCode Debugging in internal console not working
09:38 27 Mar 2023

I am using VS Code on Windows for my C/C++ assignments at University. I always wanted to debug my code in the integrated VS Code console because for me it is annoying to always have the second window open. I use the gcc/gdb compiler/debugger.

I already saw some threads on this topic which said, just go into your launch.json file and change "externalConsole": to true or use "avoidWindowsConsoleRedirection": false,. The only thing that changed was that with "externalConsole": false, the external terminal window stopped popping up, but I did not get my program output on any of the consoles at the bottom.

launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Test123",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": true,
      "cwd": "${fileDirname}",
      "environment": [],
      "externalConsole": false,
      "avoidWindowsConsoleRedirection": true,
      "MIMode": "gdb",
      "miDebuggerPath": "C:\\mingw\\bin\\gdb.exe",
      "setupCommands": [
        {
          "description": "Automatische Strukturierung und Einrückung für \"gdb\" aktivieren",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "C/C++: gcc.exe build active file"
    }
  ]
}
c++ c visual-studio-code gcc gdb