Skip to content

How to run the code #192

@billchenxi

Description

@billchenxi

Hi CPP team,
thank you so much for your effort. I have issue with the tools, I already installed everything you guys asked, and I still cannot configure out the right json files. Can you tell me what I need to do to make the debugger run in the Code?

What I did is I just create a .cpp file, then I click the debugger icon, but it keeps asking me to configure the launch.json. I have no idea how to do it. Normally I just g++ the file and then ./ the out file, so what I need to do with the visual studio code?

The error is: launch: program 'enter program name, for example /Users/bill....

What I need to replace the workspaceRoot?

my file located here :

Xis-MacBook-Pro:CPP bill$ ls
Hello       Hello.cpp   foo.h
Xis-MacBook-Pro:CPP bill$ pwd
/Users/bill/Documents/Course/pluralsight/CPP

Thank you so much, here is the json file.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C++ Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "enter program name, for example ${workspaceRoot}/a.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [],
            "externalConsole": true,
            "linux": {
                "MIMode": "gdb"
            },
            "osx": {
                "MIMode": "gdb"
            },
            "windows": {
                "MIMode": "gdb"
            }
        },
        {
            "name": "C++ Attach",
            "type": "cppdbg",
            "request": "attach",
            "program": "enter program name, for example ${workspaceRoot}/a.out",
            "processId": "${command.pickProcess}",
            "linux": {
                "MIMode": "gdb"
            },
            "osx": {
                "MIMode": "lldb"
            },
            "windows": {
                "MIMode": "gdb"
            }
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions