GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compiling a Gtk+ program for Windows

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
Warp
Familiar Face


Joined: 24 Feb 2007
Posts: 13

PostPosted: Mon Mar 12, 2007 2:26 pm    Post subject: Compiling a Gtk+ program for Windows Reply with quote

I have a C++ program which uses Gtk, and I would like to compile a Windows version of it. I would like as many of these features as possible:

1) I'd like to compile a native Windows binary, not something which needs an emulation framework around it. (I'm told mingw can do this? However, I would need more details on how to compile gtk programs with it.)

2) I'd like for the program to be a stand-alone binary without the need for the user to install Gtk in his system just to run my program. If necessary, it would be ok if there would have to be one or a few .dll files in the same directory as the executable. In other words, I would like for the program to be just one exe file and possibly one or a few dll files in a directory, and the exe file could be run directly, without the need to install anything in the system.

3) I would prefer being able to compile the Windows binary from Linux. In other words, it would be great if I didn't have to boot to Windows every time I want to compile the Windows binary for the program. (Someone has told me that this should be possible with the Linux version of mingw, but I lack details.) I would really like to not to have to install any mingw/gtk/whatever developement environments in Windows; I would like to do all the developement in Linux.

Is this possible, and if yes, how exactly?
Back to top
hydra
Familiar Face


Joined: 23 Jan 2007
Posts: 35

PostPosted: Mon Mar 12, 2007 3:44 pm    Post subject: Reply with quote

Yes, This is completely possible. I write such applications. This is my work.
You can even write and compile the windoze version of the program without to leave linux.The built exe is ready to use on windoze.
Just download and install MinGW environment and the GTK+ runtime environment for windoze.
If you use Fedora just install these RPMs for MinGW. http://mirzam.it.vu.nl/mingw/
Then install this self-extract package.
http://www.nhydra.org/files/GTK%20Platform%20Win32-1.0-Linux-x86-Install
There is available some installers on this address http://www.nhydra.org/ for GTK and MinGW on both Windoze and Linux

And then use this script to compile and build your GTK+ Win32 Application.

#!/bin/sh

EXEC_COMMAND="i386-mingw32-gcc"

# Base GTK Platform install path
GTK_BASE_PATH="/home/work_user/gtk-win32-platform"

# GTK Binary directory
GTK_BIN_DIR="base"

#GTK development directory
GTK_DEV_DIR="base-dev"

# Execute the compiling
echo "Additional source files: $@"

$EXEC_COMMAND main.c callbacks.c interface.c support.c $@ \
-o gtk-win32-out.exe \
-mms-bitfields \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/include/ \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/include/atk-1.0 \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/include/cairo \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/include/freetype2 \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/include/glib-2.0 \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/lib/glib-2.0/include \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/include/gtk-2.0 \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/lib/gtk-2.0/include \
-I$GTK_BASE_PATH/$GTK_DEV_DIR/include/pango-1.0 \
-L$GTK_BASE_PATH/$GTK_DEV_DIR/lib \
-latk-1.0 \
-lcairo \
-lfreetype \
-lgettextpo \
-lgtk-win32-2.0 \
-lglib-2.0 \
-lgdk-win32-2.0 \
-lgdk_pixbuf-2.0 \
-lgobject-2.0 \
-lgmodule-2.0 \
-lgthread-2.0 \
-lpango-1.0 \
-lzdll


If you need more particular information just PM me... I am very interested for developing GTK+ apps on both Windoze and Linux so I will be very glad to contact you.
I am wondering about creating of such user group...
Back to top
Warp
Familiar Face


Joined: 24 Feb 2007
Posts: 13

PostPosted: Mon Mar 12, 2007 5:51 pm    Post subject: Reply with quote

hydra wrote:
If you use Fedora just install these RPMs for MinGW. http://mirzam.it.vu.nl/mingw/


There doesn't seem to be a C++ compiler there, only C.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP