Use integrated terminal for debugging C++

Viewed 48

I would like to use the integrated terminal for debugging C++ files in VSCode on my Mac. I have the C/C++ extension added and enabled globally.

Here is the launch.json that I am using:

{
    // 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": "clang++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "preLaunchTask": "clang++ build active file"
        }
    ]
}

I have tried adding "console": "integratedTerminal" to this with no change. When debugging a program, the terminal output says:

> Executing task: /usr/bin/clang++ -fdiagnostics-color=always -std=c++17 -g /Users/kris/learncpp/chapter_03/debugTest4.cpp -o /Users/kris/learncpp/chapter_03/debugTest4 <


Terminal will be reused by tasks, press any key to close it.

Hitting any key here closes the terminal and drops me into a bash shell. Is there another setting I am missing somewhere?

0 Answers
Related