Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Settings for Debugging a SFML(2.6.0)game  (Read 1072 times)

0 Members and 1 Guest are viewing this topic.

moonthe4th

  • Newbie
  • *
  • Posts: 1
    • View Profile
Settings for Debugging a SFML(2.6.0)game
« 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:/"
            }
        }
    ]
}
 
« Last Edit: August 14, 2023, 04:54:25 pm by moonthe4th »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Settings for Debugging a SFML(2.6.0)game
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything