MinGW, build GUI application with console

前端 未结 4 1715
情深已故
情深已故 2021-02-02 04:19

I\'m using MinGW to build my application on Windows. When compiling and linking, the option \"-mwindows\" is put in command line to have Win32 API functions.

To be more

4条回答
  •  孤独总比滥情好
    2021-02-02 04:54

    I found the answer. As taken from Using STDIN with an AllocConsole()

    AllocConsole();
    freopen("CONIN$", "r",stdin); 
    freopen("CONOUT$","w",stdout); 
    freopen("CONOUT$","w",stderr);  
    

    It works like magic!

    Reference for 'freopen': http://www.cplusplus.com/reference/clibrary/cstdio/freopen/

提交回复
热议问题