Debugging inside visual studio code using g++

Viewed 174

I have had some random chances with debugging a c++ code inside visual studio code using the g++/gdb. Usually when I right-click on a file and select Build and Debug active file, it works
For the current scenario I am getting the following error :
In the Debug console I see the following error :
The program '/mnt/c/D-drive/a.out' has exited with code 1 (0x00000001).
This is my launch.json file

{
    // 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": "g++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "/mnt/c/D-drive/a.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

I generated the a.out file using the command g++ a1q2tester.cpp timer.cpp -std=c++0x
I have put breakpoints inside the a1q2tester.CPP file. Not sure what could be going wrong. The program just stops abruptly, and no breakpoint is triggered.

0 Answers
Related