SFML community forums

Help => General => Topic started by: moonthe4th on August 14, 2023, 04:28:29 pm

Title: Settings for Debugging a SFML(2.6.0)game
Post by: moonthe4th on August 14, 2023, 04:28:29 pm
I want to debug my sfml game for which I have created different classes in different files using VScode(On windows 11). Initially, I used the debugger without configuring launch.json file and while executing the game it wouldn't open the window and let me interact with it so that I may find where the issue is. Even after configuring the launch.json file I can't interact with the game and the window doesn't open. The launch.json file is as :
 
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug SFML Game",
            "type": "cppdbg",
            "request": "launch",
            "program": "Executable file path", // The path is updated in the original file
            "args": [], // Optional command line arguments
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "windows": {
                "MIMode": "gdb"
            },
            "pipeTransport": {
                "pipeCwd": "${workspaceFolder}",
                "pipeProgram": "sh",
                "pipeArgs": ["-c"],
                "debuggerPath": "/usr/bin/gdb"
            },
            "sourceFileMap": {
                "/mnt/c": "C:/"
            }
        }
    ]
}
 
Title: Re: Settings for Debugging a SFML(2.6.0)game
Post by: eXpl0it3r on August 15, 2023, 07:54:28 am
If you use CMake and the CMake extension for VSCode, you can run the command CMake Debug, which will launch the debugger.

If you're on Windows 11, I highly recommend using VS, as Visual Studio has the best debugger.