I am using Ubuntu 8.04. I was trying to run the example program 'Hello World' in anjuta (GUI using glade). But, it generated errors.
This was the code that generated errors.
Code:
void
on_BT_EXIT_clicked (GtkButton *button, gpointer user_data)
{
gtk_main_quit();
}
void
on_BT_OK_clicked (GtkButton *button, gpointer user_data)
{
GtkWidget *entry = lookup_widget (GTK_WIDGET(button), "ENTRY");
GtkWidget *msgbox = gnome_app_new("Hello World", "Hello World");
gchar *text1, *text2;
text1 = gtk_entry_get_text (GTK_ENTRY(entry));
text2 = g_strconcat ("Hello, ", text1, NULL);
gnome_app_message (GNOME_APP(msgbox), text2);
g_free (text2);
}
This was the Error while linking the project.
Quote:
callbacks.c:40: Undefined reference to 'lookup_widget'
|
Then I deleted the on_BT_OK_clicked section. Now on_BT_EXIT_clicked only remains. I compiled and built the project. But it showed running error. the main.c file resulted in the error. It was like this
Code:
#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 <bonobo.h>
#include <gnome.h>
#include "callbacks.h"
#include <glade/glade.h>
/* For testing propose use the local (not installed) glade file */
/* #define GLADE_FILE PACKAGE_DATA_DIR"/hw/glade/hw.glade" */
#define GLADE_FILE "hw.glade"
GtkWidget*
create_window (void)
{
GtkWidget *window1;
GladeXML *gxml;
gxml = glade_xml_new (GLADE_FILE, NULL, NULL);
/* This is important */
glade_xml_signal_autoconnect (gxml);
window1 = glade_xml_get_widget (gxml, "window");
return window1;
}
int
main (int argc, char *argv[])
{
GtkWidget *window1;
#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
argc, argv,
GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR,
NULL);
window1 = create_window ();
gtk_widget_show (window1);
gtk_main ();
return 0;
}
This was the error I found on the terminal.
Quote:
Gtk-CRITICAL **: gtk_widget_show: assertion 'GTK_IS_WIDGET (widget)' failed.
|
I also found that Glade does not automaticall generated the 'c code' for the button cliked and etc. In previous versions I notices a header file #include <gtk/gtk.h> on the callbacks.c file. But here nothing was there. I am using Anjuta 2.4.1 with Glade 3.4.2.
I have installed libgtk2.0 and also the dev files.
Please help me cure the problem.