I'm using an old 2015 macbook air ver 10.13.6 vs code Version: 1.74.0 (Universal) extensions : C/C++ , Code Runner I'm learning c++ and here's the basic code I'm trying to test to see if my vscode is good to go I'm doing this in a C++Projects folder and the file name helloworld.cpp

#include <iostream>
using namespace std;
int main() {
    cout << "Hello World!";
    return 0;
}

when I run my file it says Build finished successfully. but afterwards it says unable to start debugging

here are the other files I have that pop up

launch.json :

"configurations": [
        {
            "name": "C/C++: clang++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "preLaunchTask": "C/C++: clang++ build active file"
          }
    ]

tasks.json :

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: clang++ build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-fcolor-diagnostics",
                "-fansi-escape-codes",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}

Please help I've been searching for answers on this and can't seem to find any. Much appreciated!

checked to see if clang was installed. yes changed the task and launch files

1

There are 1 best solutions below

0
On

Install the VS Code extension, 'code lldb', with following config:

{
        "name": "clang++ - Build and debug active file",
        "type": "lldb",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": [],
        "cwd": "${workspaceFolder}",
        "preLaunchTask": "C/C++: clang++ build active file" //<-- your build task name 
}