GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 02, 2014 12:27 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Compiling a Gtk+ program for Windows
PostPosted: Mon Mar 12, 2007 2:26 pm 
Offline
Familiar Face

Joined: Sat Feb 24, 2007 2:52 pm
Posts: 13
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?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2007 3:44 pm 
Offline
Familiar Face

Joined: Tue Jan 23, 2007 6:13 pm
Posts: 34
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...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2007 5:51 pm 
Offline
Familiar Face

Joined: Sat Feb 24, 2007 2:52 pm
Posts: 13
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group