xavier-cai / vscode-leetcode-cpp-debug

Debug support for LeetCode with C++
https://marketplace.visualstudio.com/items?itemName=XavierCai.vscode-leetcode-cpp-debug
MIT License
25 stars 5 forks source link

Debug no response #33

Closed chagelo closed 3 weeks ago

chagelo commented 2 months ago

When press ctrl+shift+p, select LeetCode Debugger: Start Debugging and run, no reaction. It does not generate any files in current directory, I have set delete temporay files to false.

xavier-cai commented 2 months ago

Hi, could you share more context like what's your C++ dev env, and what code you was running the debug tool.

chagelo commented 1 month ago

Sorry for replying so late. I use this extension in windows11, my compiler is mingw g++, my code is just an empty leetcode problem. image

xavier-cai commented 1 month ago

I tried this in my local env (followed this to set up mingw g++), it works well for me.

You can try below steps:

  1. Make sure your local C++ env works: manually add main function into this leetcode problem file and debug/run it. If it works, then go next step.
  2. Run LeetCode debugger plugin with temporary file: I see your workspace already having these temporary files (though you mentioned "not generate any files"), you can go to "leetcode-main.cpp" which having the main function and debug/run it.
xavier-cai commented 1 month ago

Also, one more possible issue is the you may need to add return 0; to function maxSumDivThree.

chagelo commented 1 month ago

Sorry for replying so late. I use this extension in windows11, my compiler is mingw g++, my code is just an empty leetcode problem. image

  1. Soryy, I repeat the steps in my newly created wsl, but it seems not work. In my root path, the template files are not generated when I ctrl+shift+p.
  2. After I delete the template files in my envrioments showed int the above image, I ctrl+shift+p it does not work.
  3. After I add main and head files, it can indeed be debugged.
  4. There might be some matter with my local environment. Later I will try in my another laptop.

image

xavier-cai commented 4 weeks ago

It's a little bit confusing me on if the temporary files can be generated or not. Correct me if my understanding is wrong:

  1. You have 2 envs
    1. The first env is in Windows with mingw (shown as 1st pic), it CAN generate temporary files but can NOT start the debugging process
      1. Here is my comment: since it already generating temporary files, could you try to manully add #include "leetcode-definition.h" to your 1262.可被3整除的最大和.cpp and then start VSCode debugging on leetcode-main.cpp as it containing main function so that we can know if the VSCode debugging is not working or the debugger can not trigger the VSCode debugging process.
    2. The second env is in WSL (show as 2nd pic), it can NOT generate temporary file
      1. Here is my comment: since it can not generate temporary file, there usually having some error message when you starting the debugger via ctrl+shift+P, could you share the error message if possible. A possible reason is that the file name like 1.两数之和 is containing Chinese characters, you can try to set the value of conifgOutput File Encoding to "gbk".
chagelo commented 3 weeks ago

Both has no temporary files generated.

image
chagelo commented 3 weeks ago

Have the same Fetch problem failed: Request connect error. in my another pc, Ubuntu 22.04, I just tried several minutes ago.

xavier-cai commented 3 weeks ago

It means you have network issue, have you checked the config Source? Try to switch it to CN leetcode endpoint or just use local.

chagelo commented 3 weeks ago

Ok, it works well after I switch the Source to local. 😂

Thank you for your help.