Can't see Windows program's stdout in console (compiled with Clang on Windows)
问题 When I build a simple console app with clang, it works fine: void main() { puts("HELLO"); } But when I create a Windows app with WinMain , I can't see stdout. There must be a flag that fixes it, like MinGW's -mconsole 回答1: A quick stdout-enabler for otherwise GUI apps: if (AllocConsole()) { FILE* fi = 0; freopen_s(&fi, "CONOUT$", "w", stdout); } and then std::cout and printf work. 回答2: WinMain is a custom microsoft entry function for a windows graphical application (with windows and menus etc