Re: gtk win32 app without console
- From: Todd Fisher <taf2 lehigh edu>
- To: Harring Figueiredo <harringf yahoo com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: gtk win32 app without console
- Date: Wed, 07 Jul 2004 17:24:57 -0400
Felix,
I use the following in my win32/gtk+ programs. In debug mode I
like to see all the output from the console, but when i compile for release
I don't like to see all the output from the console. So, here's what I usually
do assuming you're compiling with visual C, which includes /DNDEBUG for release
and /DDEBUG for debug:
#include <gtk/gtk.h>
#ifdef NDEBUG
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h> // included for WinMain
#endif
static void nullout( const char *str )
{ // might want to save these logs to a file
}
static void logfunc( const char *dom,
GLogLevelFlags log_level,
const gchar *message,
gpointer user_data)
{ // might want to save these logs to a file
}
#endif
static void set_up_logger()
{
#ifdef NDEBUG
// we don't want the console appearing on us in release mode
g_set_print_handler( nullout );
g_set_printerr_handler( nullout );
g_log_set_handler( NULL, (GLogLevelFlags)(
G_LOG_LEVEL_MASK |
G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION ), logfunc, NULL );
#endif
}
int main( int argc, char **argv )
{
// normal gtk+ stuff goes here
}
#ifdef _WIN32
#ifdef NDEBUG
int APIENTRY WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
return main( __argc, __argv );
}
#endif
#endif
Harring Figueiredo wrote:
The compiler flag -mnowindows or -mwindows (one of the 2). Apparently does
the trick.
Let me know if it works.
Harring Figueiredo.
--- "F. Kater" <f kater2 gmx net> wrote:
Hi,
I hope you don't find this issue too off topic here! :-)
I am developing a gtk win32 app. As IDE I use ms visual studio c++ 6.0.
This projects was created once as an "empty console application" to be
most indipendant from ms -- however, now I would like to turn off the
console running in the background of my app. I don't use any ms
dependant stuff.
Is there an easy to do that -- port main(...) to WinMain(...) etc?
Felix
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]