Can't seem to get rid of the console window (Windows port)



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I'm porting my GTK application to Windows (MinGW with gcc), and am
finding it impossible to get rid of the "DOS box" windows console that
appears when the program is launched.

Seen lots of posts recommending using the "-mwindows" flag, and others
recommending also capturing/redirecting log output.

Doing all of that, but still no luck.

After wasting many, many hours trying every suggestion Google-able
(really), I then tried to make just a very basic GTK app that wouldn't
open a DOS box.  Still no luck.  (Ugh!)

Can anyone see what might be wrong in the following?

*************

// This is the cut-to-nothing program stub that still opens a console

// GTK includes
#include <gtk/gtk.h>
#include <windows.h>

void nullout(const char *str)
{
  // might want to save these logs to a file
}

void your_logger(const gchar *log_domain, GLogLevelFlags log_level,
const gchar *message, gpointer user_data)
{
  // Do here what you want with your warning messages
}

// The main program loop
gint main(gint argc, gchar *argv[])
{
  GtkWidget                     *main_window;

  gtk_init(&__argc, &__argv);
  g_set_print_handler( nullout );
  g_set_printerr_handler( nullout );
  g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION, your_logger, NULL);
  g_log_set_handler ("Gdk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION, your_logger, NULL);
  g_log_set_handler ("Gtk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION, your_logger, NULL);
  g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION, your_logger, NULL);
  g_log_set_handler ("GModule", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION, your_logger, NULL);
  g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
| G_LOG_FLAG_RECURSION, your_logger, NULL);
  g_log_set_handler ("GThread", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
G_LOG_FLAG_RECURSION, your_logger, NULL);

  // Start up the GUI part of things
  main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

  // Display the main window
  gtk_widget_show_all(main_window);

  gtk_main();

  exit(0);
}

*************

And the compilation stuff:

*************

make -k all
Building file: ../flame-edit.c
Invoking: GCC C Compiler
gcc -DORBIT2=1 -Ic:/MinGW/include/gtk-2.0
- -Ic:/MinGW/include/libgnome-2.0 -Ic:/MinGW/include/libbonobo-2.0
- -Ic:/MinGW/include/gnome-vfs-2.0
- -Ic:/MinGW/include/bonobo-activation-2.0 -Ic:/MinGW/include/gconf/2
- -Ic:/MinGW/include/orbit-2.0 -IC:\MinGW\libxml2-2.6.23.win32\include
- -Ic:/MinGW/lib/gtk-2.0/include -Ic:/MinGW/include/atk-1.0
- -Ic:/MinGW/include/cairo -Ic:/MinGW/include/pango-1.0
- -Ic:/MinGW/include/glib-2.0 -Ic:/MinGW/lib/glib-2.0/include -O0 -Wall -c
- -fmessage-length=0 -mms-bitfields -mno-cygwin -mwindows -oflame-edit.o
../flame-edit.c
Finished building: ../flame-edit.c

Building target: flame-edit.exe
Invoking: GCC C Linker
gcc -Lc:/MinGW/lib -Lc:/MinGW/libxml2-2.6.23.win32/lib
- -Lc:/devel/target/stable/lib -Lc:/opt/gnuwin32/lib -oflame-edit.exe
./flame-edit.o -lgtk-win32-2.0 -lpng14 -lungif4 -lming -lzdll -lpopt
- -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lxml2 -lgdk-win32-2.0
- -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0
- -lfontconfig -lfreetype -lpango-1.0 -lm -lcairo -lgobject-2.0
- -lgmodule-2.0 -lglib-2.0 -lintl -liconv
Finished building target: flame-edit.exe

Build complete for project flame-edit

*************

When I run flame-edit.exe, voila a blank default-sized GTK window pops
up, as does a DOS box (AAARGGH!).

Suggestions?

Regards and best wishes,

Justin Clift

- --
The Flame Project - Open Source GUI for animated SVG & Flash
http://www.flameproject.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEjB5sFAuZn5lS2IMRAuDcAKDqwVmVeDiuOilylrrd9e0YkCT8TgCeKvbD
leYHs4ED9mOX1QejDL5CQNY=
=vngo
-----END PGP SIGNATURE-----




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