LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-09-2008, 08:21 AM   #1
swift2008
Member
 
Registered: Jul 2008
Posts: 78

Rep: Reputation: 15
gtk installation in windows xp


Hi all
how to install and run gtk and gtk applications in windows xp or vista.

can you please tell me the procedure and steps..
i googled a lot but no use.

any help it should appreciable
 
Old 09-09-2008, 08:26 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I got lots of hits in Google ("Linux applications in Windows"):
http://www.google.com/search?q=linux...L_enUS177US235
 
Old 09-09-2008, 09:07 AM   #3
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Visit the gtk website and download Windows binaries.
Run installer.
Done.
 
Old 09-10-2008, 12:59 AM   #4
swift2008
Member
 
Registered: Jul 2008
Posts: 78

Original Poster
Rep: Reputation: 15
hi all
thank you for reply

what are the list of packages to install in windows machine to run gtk application or gtk programs perfectly.
i am new to windows machine.
i need to develop a gui application in windows using gtk and c.

please help me

any help it should be appreciable
 
Old 09-10-2008, 09:49 AM   #5
rubadub
Member
 
Registered: Jun 2004
Posts: 236

Rep: Reputation: 33
I did this last night, a lot easier than I thought it would be.
I went to gtk page, dl'd the all in one package, extracted, read the read me, added the bin dir to the path, then ran a command listed in the read me, the output looked good. Started up codeblocks IDE, created a new default gtk project, compiled and ran sweet as. Then today i've ported a few of my apps just as easily... Then copied over to another machine, ran the release prog, no joy, so quickly copied the bin dir over, dropped my prog in and it ran like it had 64 legs, don't know what to call it, maybe a wobbly centipede?
 
Old 09-12-2008, 01:26 AM   #6
swift2008
Member
 
Registered: Jul 2008
Posts: 78

Original Poster
Rep: Reputation: 15
hi all
these all for windows-32 machine.

yeah. i installed gtk bundle.
i wrote a gtk program in the desktop.
how can i compile the program.
gcc command not working.

and how to use glade tool in windows

any help it should be appreciable
 
Old 09-12-2008, 05:11 AM   #7
rubadub
Member
 
Registered: Jun 2004
Posts: 236

Rep: Reputation: 33
Have you installed gcc, e.g. mingw or cygwin ? ?
 
Old 09-15-2008, 12:09 AM   #8
swift2008
Member
 
Registered: Jul 2008
Posts: 78

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by rubadub View Post
Have you installed gcc, e.g. mingw or cygwin ? ?
yeah i installed.
gcc is working fine.
but when i compiling the gtk code, getting some errors.
Quote:
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>

GtkWidget *colorseldlg = NULL;
GtkWidget *drawingarea = NULL;
GdkColor color;

/* Color changed handler */

static void color_changed_cb( GtkWidget *widget,
GtkColorSelection *colorsel )
{
GdkColor ncolor;

gtk_color_selection_get_current_color (colorsel, &ncolor);
gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &ncolor);
}

/* Drawingarea event handler */

static gboolean area_event( GtkWidget *widget,
GdkEvent *event,
gpointer client_data )
{
gint handled = FALSE;
gint response;
GtkColorSelection *colorsel;

/* Check if we've received a button pressed event */

if (event->type == GDK_BUTTON_PRESS)
{
handled = TRUE;

/* Create color selection dialog */
if (colorseldlg == NULL)
colorseldlg = gtk_color_selection_dialog_new ("Select background color");

/* Get the ColorSelection widget */
colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (colorseldlg)->colorsel);

gtk_color_selection_set_previous_color (colorsel, &color);
gtk_color_selection_set_current_color (colorsel, &color);
gtk_color_selection_set_has_palette (colorsel, TRUE);

/* Connect to the "color_changed" signal, set the client-data
* to the colorsel widget */
g_signal_connect (G_OBJECT (colorsel), "color_changed",
G_CALLBACK (color_changed_cb), (gpointer) colorsel);

/* Show the dialog */
response = gtk_dialog_run (GTK_DIALOG (colorseldlg));

if (response == GTK_RESPONSE_OK)
gtk_color_selection_get_current_color (colorsel, &color);
else
gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &color);

gtk_widget_hide (colorseldlg);
}

return handled;
}

/* Close down and exit handler */

static gboolean destroy_window( GtkWidget *widget,
GdkEvent *event,
gpointer client_data )
{
gtk_main_quit ();
return TRUE;
}

/* Main */

gint main( gint argc,
gchar *argv[] )
{
GtkWidget *window;

/* Initialize the toolkit, remove gtk-related commandline stuff */

gtk_init (&argc, &argv);

/* Create toplevel window, set title and policies */

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Color selection test");
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, TRUE);

/* Attach to the "delete" and "destroy" events so we can exit */

g_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (destroy_window), (gpointer) window);

/* Create drawingarea, set size and catch button events */

drawingarea = gtk_drawing_area_new ();

color.red = 0;
color.blue = 65535;
color.green = 0;
gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &color);

gtk_widget_set_size_request (GTK_WIDGET (drawingarea), 200, 200);

gtk_widget_set_events (drawingarea, GDK_BUTTON_PRESS_MASK);

g_signal_connect (GTK_OBJECT (drawingarea), "event",
GTK_SIGNAL_FUNC (area_event), (gpointer) drawingarea);

/* Add drawingarea to window, then show them both */

gtk_container_add (GTK_CONTAINER (window), drawingarea);

gtk_widget_show (drawingarea);
gtk_widget_show (window);

/* Enter the gtk main loop (this never returns) */

gtk_main ();

/* Satisfy grumpy compilers */

return 0;
}
compile:
Code:
gcc color.c -o color `pkg-config gtk+-2.0 --cflags --libs`
pkg-config not found
glib.h not found
.....

what i have to do.
how to compile this program in windows machine.

and also i installed glade tool for developing some gui.
in that tool i cant find build button.
i find save button, if i click this the only "project.glade" is saving.
how to build the code for glade.

any help it should appreciable.
 
Old 09-15-2008, 12:38 AM   #9
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Quote:
pkg-config not found
glib.h not found
if MinGW then there a LOT of files that need to be edited for the correct path . Almost every script in
C:\\GnuWin32/MinGW/bin
C:\\GnuWin32/MinGW/lib/pkgconfig
and some in
C:\\GnuWin32/MinGW/share
C:\\GnuWin32/MSys/bin
also add to the windows system path ( BEFORE C:\\Program Files\Microsoft Visual Studio -- if installed)C:\\GnuWin32/MinGW/bin,C:\\GnuWin32/MinGW/lib,C:\\GnuWin32/MSys/bin,C:\\GnuWin32/MinGW/share
--------
the first thing i do with a new mingw install( after getting it configured) is to build " the gimp" if it builds ,installs and runs then Mingw is set up and ready to go .

Last edited by John VV; 09-15-2008 at 12:52 AM. Reason: added to
 
Old 09-15-2008, 03:41 AM   #10
swift2008
Member
 
Registered: Jul 2008
Posts: 78

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by John VV View Post
if MinGW then there a LOT of files that need to be edited for the correct path . Almost every script in
C:\\GnuWin32/MinGW/bin
C:\\GnuWin32/MinGW/lib/pkgconfig
and some in
C:\\GnuWin32/MinGW/share
C:\\GnuWin32/MSys/bin
also add to the windows system path ( BEFORE C:\\Program Files\Microsoft Visual Studio -- if installed)C:\\GnuWin32/MinGW/bin,C:\\GnuWin32/MinGW/lib,C:\\GnuWin32/MSys/bin,C:\\GnuWin32/MinGW/share
--------
the first thing i do with a new mingw install( after getting it configured) is to build " the gimp" if it builds ,installs and runs then Mingw is set up and ready to go .
it is not helpful.
i given the path too.
can anybudy give the appropriate solution for this.
 
Old 09-15-2008, 08:24 AM   #11
rubadub
Member
 
Registered: Jun 2004
Posts: 236

Rep: Reputation: 33
i'm not near a win machine at mo, but, oh that might be an example above... have you added the appropriate directories to the 'path' variable (my comp -> ? -> system variables -> path...?)
 
Old 09-15-2008, 09:37 AM   #12
elprawn
Member
 
Registered: Feb 2005
Distribution: Gentoo 2008
Posts: 138

Rep: Reputation: 15
I have Gimp installed on my copy of Win XP and I'm pretty sure that comes with GTK, does it not?
 
Old 09-15-2008, 11:51 AM   #13
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
the reason i told you to add paths to The WINDOWS xp/vista SYSTEM path
is gcc is not finding "pkg-config" .Are automake,autoconf,and pkgconfig,... installed
also " glib.h " is not being found in " C:\\GnuWin32\MinGW\include "
is glibc installed
-------------
also rename " pkg-config " to " pkgconfig " in your build command
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gtk and Glade: How to put windows inside windows enemorales Programming 1 07-13-2006 10:01 AM
gtk+- 2.6.10 installation vnutheti Linux - Newbie 2 03-30-2006 12:28 PM
GTK+ programs on Windows without having to install GTK+, GLib, etc Nylex Programming 2 02-19-2006 01:33 PM
GTK+2 Installation secureoffice SUSE / openSUSE 9 10-10-2005 01:25 PM
Gtk Installation Elbryan Fedora 1 02-23-2005 06:47 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration