microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.59k stars 28.39k forks source link

Can't execute Cpp code in VS Code #221559

Closed Znull-1220 closed 3 weeks ago

Znull-1220 commented 1 month ago

Type: Performance Issue

Hi VS Code developer team, I used to program Cpp in VS Code, my compiler is MINGW64, used with c/c++ extension pack. But after I update my VS code last time, I can't run and debug C++ code normally as I used to do. The Debug process could run normally, but there wasn't any output message. I have cloned my former repo from my github to restore my settings and code, but I still can't run the code. Hence, I would like to know if there is some bugs with C++ in recent updates. Best Regards, Zhang

VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 5 5600H with Radeon Graphics (12 x 3294)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|15.35GB (5.27GB free)| |Process Argv|C:\\Users\\Zhang JH\\Desktop\\CPP_DSA --crash-reporter-id 0938ea81-e7c6-4fa9-aba9-78897dfd05f3| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 0 149 25024 code main 0 83 3984 fileWatcher [1] 0 108 8488 window [3] (问题报告程序) 0 115 12780 shared-process 0 98 26392 "D:\Program files\Microsoft VS Code\Code.exe" "d:\Program files\Microsoft VS Code\resources\app\out\bootstrap-fork" ms-vscode.cppdbg "{\"common.vscodemachineid\":\"76b654e26163840dd300a070ffaacf8ab10253f502cb744fe8f641950789f5a2\",\"common.vscodesessionid\":\"38b11f76-35f1-475c-b79f-c37212c831fb1720784824016\"}" 0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255 0 41 13260 utility-network-service 0 252 15324 window [2] (发行说明: 1.91.1 - CPP_DSA-1 - Visual Studio Code) 0 379 19888 extensionHost [1] 0 89 6064 "D:\Program files\Microsoft VS Code\Code.exe" "d:\Program files\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=19888 0 84 14644 "c:\Users\Zhang JH\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64\bin\cpptools.exe" 0 11 17368 C:\Windows\system32\conhost.exe 0x4 0 3 17532 "c:\Users\Zhang JH\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64\bin\cpptools.exe" 0 34 20080 "c:\Users\Zhang JH\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64/bin/cpptools-srv.exe" 14644 {6DB89766-0676-436D-AF2E-A3DCC62BE435} 0 11 19660 C:\Windows\system32\conhost.exe 0x4 0 147 21756 window 0 93 24188 ptyHost 0 76 6616 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"d:\Program files\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\browser\media\shellIntegration.ps1\" } catch {}" 0 18 22472 "C:\Users\Zhang JH\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64\debugAdapters\bin\WindowsDebugLauncher.exe" --stdin=Microsoft-MIEngine-In-0vuku0ku.krp --stdout=Microsoft-MIEngine-Out-4xridbze.2kw --stderr=Microsoft-MIEngine-Error-k2gehpun.kfu --pid=Microsoft-MIEngine-Pid-rxf0fsmt.anh "--dbgExe=D:\Program files\mingw64\bin\gdb.exe" --interpreter=mi 0 74 11824 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"d:\Program files\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\browser\media\shellIntegration.ps1\" } catch {}" 0 9 19480 conpty-agent 0 9 26860 conpty-agent 0 273 26504 gpu-process 0 29 27264 crashpad-handler 0 364 28692 extensionHost [2] 0 34 26692 "c:\Users\Zhang JH\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64\debugAdapters\bin\OpenDebugAD7.exe" 0 11 22004 C:\Windows\system32\conhost.exe 0x4 0 98 31128 "c:\Users\Zhang JH\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64\bin\cpptools.exe" 0 6 2096 "c:\Users\Zhang JH\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64\bin\cpptools.exe" 0 19 21868 "c:\Users\Zhang JH\.vscode\extensions\ms-vscode.cpptools-1.20.5-win32-x64/bin/cpptools-srv.exe" 31128 {E6E7B9EF-BE4B-4D43-8C4E-C53D0F31C5DA} 0 11 18880 C:\Windows\system32\conhost.exe 0x4 0 11 25836 C:\Windows\system32\conhost.exe 0x4 0 96 28928 fileWatcher [2] 0 221 31728 window [1] (test.cpp - CPP_DSA - Visual Studio Code) ```
Workspace Info ``` | Window (发行说明: 1.91.1 - CPP_DSA-1 - Visual Studio Code) | Window (test.cpp - CPP_DSA - Visual Studio Code) | Folder (CPP_DSA-1): 13 files | File types: cpp(3) exe(3) json(2) | Conf files: settings.json(1) tasks.json(1) | Folder (CPP_DSA): 19 files | File types: exe(7) cpp(5) | Conf files:; ```
Extensions (37) Extension|Author (truncated)|Version ---|---|--- zoterolatex|bna|0.4.1 doxdocgen|csc|1.4.0 copilot|Git|1.213.0 copilot-chat|Git|0.17.1 vscode-pull-request-github|Git|0.92.0 latex-workshop|Jam|10.1.0 leetcode-helper|lab|1.5.6 vscode-latex|mat|1.3.0 vscode-docker|ms-|1.29.1 vscode-language-pack-zh-hans|MS-|1.91.2024071009 debugpy|ms-|2024.8.0 python|ms-|2024.10.0 vscode-pylance|ms-|2024.7.1 jupyter|ms-|2024.6.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.18 tensorboard|ms-|2023.10.1002992421 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-ssh|ms-|0.112.0 remote-ssh-edit|ms-|0.86.0 cmake-tools|ms-|1.18.43 cpptools|ms-|1.20.5 cpptools-extension-pack|ms-|1.3.0 remote-explorer|ms-|0.4.3 autodocstring|njp|0.6.1 vscode-qt-for-python|sea|7.6.0 remote-x11|spa|1.5.0 remote-x11-ssh|spa|1.5.0 ayu|tea|1.0.5 cmake|twx|0.0.17 intellicode-api-usage-examples|Vis|0.2.8 vscodeintellicode|Vis|1.3.1 theme-demo|xin|0.0.1 zotero-cite|XIN|0.8.6 markdown-all-in-one|yzh|3.6.2 pyqt-integration|zho|0.2.0 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 vscaac:30438847 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 9c06g630:31013171 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 impr_priority:31094925 ```
amrmzr commented 1 month ago

Same issue here :(

Znull-1220 commented 1 month ago

However, When I use the extension C/C++ Compile Run, I could run the code and see the output of the proc, but I still could't debug.

amrmzr commented 1 month ago

However, When I use the extension C/C++ Compile Run, I could run the code and see the output of the proc, but I still could't debug.

Hi Greetings!

I had exactly same issue, but I found a solution and it does work for me as it should normally. Go to official vs code website and install older "May 2024 recovery 2 or 1" version and install it. it will fix the issue and if you want to update again, update from vs code editor. the issue should be gone even after upgrading to latest v1.91.1 vs code. Hope it helps.

install: https://code.visualstudio.com/updates/v1_90

Thanks!

Znull-1220 commented 1 month ago

However, When I use the extension C/C++ Compile Run, I could run the code and see the output of the proc, but I still could't debug.

Hi Greetings!

I had exactly same issue, but I found a solution and it does work for me as it should normally. Go to official vs code website and install older "May 2024 recovery 2 or 1" version and install it. it will fix the issue and if you want to update again, update from vs code editor. the issue should be gone even after upgrading to latest v1.91.1 vs code. Hope it helps.

install: https://code.visualstudio.com/updates/v1_90

Thanks!

Hi Ammar Mazhar, thanks a lot for your reply.

I have followed your instructions and reinstalled VS Code, but it didn't work for me. I wonder whether you reinstalled all the extensions, or just uninstalled the new version and installed the older version you mentioned.

amrmzr commented 1 month ago

However, When I use the extension C/C++ Compile Run, I could run the code and see the output of the proc, but I still could't debug.

Hi Greetings! I had exactly same issue, but I found a solution and it does work for me as it should normally. Go to official vs code website and install older "May 2024 recovery 2 or 1" version and install it. it will fix the issue and if you want to update again, update from vs code editor. the issue should be gone even after upgrading to latest v1.91.1 vs code. Hope it helps. install: https://code.visualstudio.com/updates/v1_90 Thanks!

Hi Ammar Mazhar, thanks a lot for your reply.

I have followed your instructions and reinstalled VS Code, but it didn't work for me. I wonder whether you reinstalled all the extensions, or just uninstalled the new version and installed the older version you mentioned.

Hey Greetings!

it works for a while though :( made a new program and suddenly same problem persists. As you said, can run a program, build but can't debug.

roblourens commented 3 weeks ago

Docs at https://code.visualstudio.com/docs/cpp/cpp-debug

If there's an issue, you can file an issue with more details on the repo for the C++ extension