microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

integrated terminal does not support std::thread output #12393

Open luabud opened 5 months ago

luabud commented 5 months ago

This issue was reported on the Python extension repo so I'm manually "transferring" it here: https://github.com/microsoft/vscode-python/issues/23639

Type: Bug

Version: 1.90.1 (user setup) Commit: 611f9bfce64f25108829dd295f54a6894e87339d Date: 2024-06-11T21:01:24.262Z Electron: 29.4.0 ElectronBuildId: 9593362 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.22631

#include<thread>
#include<iostream>

void hello() {
    std::cout << "hello" << std::endl;
}

int main() {
    std::thread t{hello};
    t.join();
    return 0;
}

I write a simple program using std::thread, and compile it with g++. This .exe file works fine in single cmd.exe, but does not print anything in integrated terminal in vscode g++ comes from MinGW posix thread model

in external cmd, the a.exe can print "hello" Snipaste_2024-06-19_20-22-02

but in integrated cmd, the a.exe doesn't print anything image

and .exe works with a New Window VSCode

image

Extension version: 2024.6.0 VS Code version: Code 1.90.1 (611f9bfce64f25108829dd295f54a6894e87339d, 2024-06-11T21:01:24.262Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|13th Gen Intel(R) Core(TM) i7-13700 (24 x 2112)| |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)|63.68GB (49.66GB free)| |Process Argv|--crash-reporter-id 35349f8c-5c73-4833-b906-6d9dd1538fcc| |Screen Reader|no| |VM|50%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelt:31048053 dsvsc021:30996838 945dj816:31013170 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 pythonprt:31056678 dwnewjupyter:31046869 2f103344:31071589 legacy_priority:31077528 ```
sean-mcmanus commented 5 months ago

@luabud This might be the same as https://github.com/microsoft/vscode-cpptools/issues/5497 .