i'm far being windows programmer, not windows user, should cross-compile application windows using mingw32. problem: console output not work. it's gui application, compiled -mwindows
. tried use allocconsole()
indeed produces console window, still no output printf()
, friends. tried use freopen()
on name conout$
with/without using setvbuf(stdout, null, _ionbf, 0)
. these mentioned several resources can help, still no output @ in console window. feel lost can't imagine can more, msdn pages seems agree right thing (if read them correctly ...), still no output :(
#include <stdio.h> #include <windows.h> int main ( void ) { freeconsole(); // sure had no console before allocconsole(); // setconsoletitle("test console"); freopen("conout$", "w", stdout); setvbuf(stdout, null, _ionbf, 0); printf("hello, world!\n"); sleep(10); return 0; }
simply compiled (on linux): i686-w64-mingw32-gcc -o test.exe test.c -mwindows
please note, problem exists in more complex software. in example may choose use console application instead of gui then, have problem with, sdl2 application otherwise , can't console application, need console too. code above test case. tried comment call of freopen()
, setvbuf()
out, modify order, etc, didn't helped.
Comments
Post a Comment