Re: g_message and g_warning under Windows



Thanks for your replies.

What you said makes sense and it is what I experienced in GTK+ 2.4.2 under Windows, the problem is that I do not seem to be able to get a g_message() type message to stderr in GTK+ 2.6.0. I have used the following redirection:

FILE* stream;
stream = freopen("error.log","w",stderr);

And I have tested it with:

g_message("g_message_test");
fprintf(stderr,"fprintf_test");

which sits in the init function for my main window class. The fprintf statement works fine, but the g_message() function seems to do nothing.

Richard.

At 22:05 13/02/05, you wrote:
Russell Shaw writes:
 > Richard Gipps wrote:
 > > I notice that under GTK+ 2.6 (in Windows), a call to g_error()
 > > brings up a dialogue box with the error message,

Yes, fatal errors do that (before calling abort()). It is somewhat
debatable, and might get removed in the future. Some application
developers feel that it's not GLib's business to do any kind of GUI,
even if just a Win32 MessageBox.

 > It outputs the message to stderr or stdout

It does this on Windows, too. But note that in "windowing"
applications (i.e. those linked with the -mwindows flag (GNU tools) or
/subsystem:windows (MSFT)) stderr and stdout aren't connected to
anything (unless you redirect them from the command line, or freopen
them in the application), thus the output typically goes nowhere.

--tml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]