Using the minimum run-time packages to run a standalone GTK+ windows application
consider the simplest gtk+开发者_如何学运维 application:
#include <gtk/gtk.h>
int main( int argc, char *argv[])
{
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();
return 0;
}
I compile it succesfully on Windows using this:
gcc -o hello.exe hello.c -mms-bitfields -IC:/gtk/include/gtk-2.0 -IC:/gtk/lib/gtk-2.0
/include -IC:/gtk/include/atk-1.0 -IC:/gtk/include/cairo -IC:/gtk/include/gdk-pixbuf-2.0 -IC:/gtk/include/pang
o-1.0 -IC:/gtk/include/glib-2.0 -IC:/gtk/lib/glib-2.0/include -IC:/gtk/include -IC:/gtk/include/freetype2 -IC:
/gtk/include/libpng14 -LC:/gtk/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi
32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0
-lintl
In order to run hello.exe as a standalone program I include whith it all the GLib, cairo, Pango, ATK, gdk-pixbuf, gettext-runtime, fontconfig, freetype, expat, libpng and zlib run-time packagages. The program runs very well, the problem is that all this run-time stuff takes about 40 MB of disk space.
¿Do this simple program need all the files in ./share/locale (25 MB)? ¿Is there any way to use the minimum run-time packages to run my application on Windows?
Thanks
./share/locale/* includes the translations, so you have to choose yourself. Do you want to have translations or do you want to save disk space? Depending on how you ship your application (for example simply packed in a .rar or with an installer), you can install those translations conditionally. The only required files are the libraries, like libgtk-x11-2.0.dll, libglib-2.0.dll, …
精彩评论