Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

gtk program using glade

Posted on 2004-08-09
2
Medium Priority
?
816 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

636 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