2

I'm trying to run the debugger, by typing into the terminal:

debug50 ./filename 

But unfortunately an error comes up in the terminal, saying:

Failed to connect extension server on port None.
Please refresh the page and try again.

Heres an image of the error message, and my what IDE currently looks like, if that helps:

enter image description here

Any help would be appreciated, cheers!

EDIT: I have set a breakpoint already as well, as per the documentation here: https://cs50.harvard.edu/ap/2020/assets/pdfs/bugs_and_debugging.pdf

1 Answer 1

2

I believe you're using VS Code locally, right? I had no problem using the codespace in the browser, but when I used it in my locally installed VS Code, there was this problem with debug50 in codes using language C (with python there was no problem). Here's how I solved it:

First, I manually installed the cpptools (https://github.com/microsoft/vscode-cpptools/releases). If you don't know how to install from a .vsix, here's how to do it: https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix

After that, it wasn't yelling the error of failed connection anymore and started opening the debugger.

But in my case, the debugger closed almost instantly after its opening. If that happens to you, do the following:

Go to Extensions > CODESPACES - INSTALLED, and re-install the extention C/C++.

1
  • This worked for me! In my case I was getting: Launching VS Code debugger... Unable to launch debugger. and after installing cpptools it worked. However, I did it from the extensions tab in VSCode. As per cpptools github (link), I simply switched to pre-release version, then reloaded the codespace. Not sure of the implications of this but it worked.
    – Jadelcar
    Aug 30, 2022 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .