Re: RE :Problem with gtk (done mistake)

On Mon, Dec 18, 2006 at 09:33:56AM +0530, Naveen Kumar wrote:
> Hi all,
> Please excuse for my mistake...
> I am very sorry for sending a wrong part of the code it is actually..
> #include <stdio.h>
> int main ()
> {
> int i=0;
> while(i < 264000)
> printf("%d\n",i++);
> }

name the below 'trial.c'
compile with: gcc -Wall -g `pkg-config --cflags --libs gtk+-2.0` trial.c   -o trial
it runs correctly for me without trouble.  you have trouble?
#include <gtk/gtk.h>

static void handle_destroy (GtkWidget *window, gpointer data) { gtk_main_quit (); }

static void
handle_click (GtkWidget *button, gpointer data)
  int i=0;
  while(i < 264000)

int main (int argc, char **argv)
  GtkWidget *window, *button;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  button = gtk_button_new_with_label ("do something");

  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (handle_destroy), NULL);
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (handle_click), NULL);

  gtk_container_add (GTK_CONTAINER (window), button);
  gtk_widget_show_all (window);

  gtk_main ();
  return 0;

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