?
Solved

gtk program using glade

Posted on 2004-08-09
2
Medium Priority
?
808 Views
Last Modified: 2008-01-09
Hello
    I am new to gtk programming  in c using glade.

 I have written a basic program which is as follows
/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"

#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)

 void on_cmdHello_clicked( GtkWidget *widget, gpointer data)
{
    g_print ("Hello World\n");
}

GtkWidget*
create_window1 (void)
{
  GtkWidget *window1;
  GtkWidget *vbox1;
  GtkWidget *hbox2;
  GtkWidget *txtHelloWorld;
  GtkWidget *hbox1;
  GtkWidget *cmdHello;

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window1), _("window1"));

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (window1), vbox1);

  hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox2);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox2, TRUE, TRUE, 0);

  txtHelloWorld = gtk_entry_new ();
  gtk_widget_show (txtHelloWorld);
  gtk_box_pack_start (GTK_BOX (hbox2), txtHelloWorld, TRUE, TRUE, 0);
  gtk_widget_set_size_request (txtHelloWorld, 158, 24);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);

  cmdHello = gtk_button_new_with_mnemonic (_("Hello World"));
  gtk_widget_show (cmdHello);
  gtk_box_pack_start (GTK_BOX (hbox1), cmdHello, FALSE, FALSE, 0);
  gtk_widget_set_size_request (cmdHello, 76, 26);

  g_signal_connect ((gpointer) cmdHello, "clicked",
                    G_CALLBACK (on_cmdHello_clicked),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window1, window1, "window1");
  GLADE_HOOKUP_OBJECT (window1, vbox1, "vbox1");
  GLADE_HOOKUP_OBJECT (window1, hbox2, "hbox2");
  GLADE_HOOKUP_OBJECT (window1, txtHelloWorld, "txtHelloWorld");
  GLADE_HOOKUP_OBJECT (window1, hbox1, "hbox1");
  GLADE_HOOKUP_OBJECT (window1, cmdHello, "cmdHello");

  return window1;
}

on compiling it gives error  
interface.c:30: conflicting types for `on_cmdHello_clicked' at line 30

i cant under stand it. can anybody help
thanks in advance

0
Comment
Question by:rajneesh75
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
akshayxx earned 150 total points
ID: 11769742
most likely, you are having conflicting types for the function

on_cmdHello_clicked'
check the way you have declared it in the other .c/.h files..
it should match with the definition of the function in the file u have listed in here
good luck
akshay
0
 
LVL 1

Author Comment

by:rajneesh75
ID: 11770445
thanks . I solved the problem by putting the code of  signal handler in callbacks.c file instead of interface.c

looking for support in future
thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question