Can’t debug a c++ project that I download from github using vs code

  Kiến thức lập trình

I’m new to vscode. I’m trying to debug an example in the project to find out a value that I’m trying to track on. I had searched a lot of tutorials and forums that non of them can work it out. The project is from https://github.com/s-vincent/jsonrpc-cpp.git. Please, I need any instructions that can solve this problem. I am stuck and I don’t know what to do next.

This is my launch.json file

{
    "configurations": [
        {
            "name": "C/C++: g++ build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/examples/tcp-server",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ],
    "version": "2.0.0"
}

First, I enter make to generate the target file “tcp-server” from cpp file “tcp-server.cpp”. Then I press F5 to debug, it says that The preLaunchTask ‘C/C++:g++ build active file’ terminated with exit code -1. Then, I check the problems tab at the bottom of the window, it says that no problems have been detected in the workspace.

here is a screenshot

My system is Ubuntu20.04 in virtualbox.

New contributor

SpareAssassin52 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT