"Run without debugging" or Ctrl+F5 always starts the debugger in VS Code

Viewed 46

The problem is in the title. There is no difference between pressing F5 and Ctrl+F5 or the equivalent navigation bar buttons. GDB debugger always starts and VS Code enters the debug view. I've looked around for solutions, but haven't been able to find anything. I'm using the default C/C++ extension.

launch.json:

{
  "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": "g++ build active file",
      "miDebuggerPath": "/usr/bin/gdb"
    }
  ]
}

tasks.json:

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: /usr/bin/g++"
        }
    ],
    "version": "2.0.0"
}

The problem only happens in C/C++. Python works fine. I am using Ubuntu 20.04. If anyone knows how to fix this I would appreciate it. Thanks.

0 Answers
Related