Weird Error



I found this weird error after compiling this source code 
:

#include<gtk/gtk.h>

/* A callback that destroys or closes the program
 */
void destroy(void)
{
  gtk_main_quit ();
}

void main_window()
{
  /* All (I think) of the widgets are initialized or prototyped here
   */
  //  GtkWidget *Iconbutton;
 
  GtkWidget* window;
  GktWidget* main_hbox;
  GtkWidget* vbox1;
  GtkWidget* vbox2;
  GtkWidget* scrolled_window;
  GtkWidget* menu;
  GtkWidget* menu_bar;
  GtkWidget* menu_items;
  GtkWidget* root_menu;

  /* Main Window Settings etc.
   */
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title ("Origins");


  /* Callbacks that will close the program when the X in WM is pushed
   */
  gtk_signal_connect (GTK_OBJECT(window), "destroy",
		      GTK_SIGNAL_FUNC (destroy), NULL);
  
  gtk_signal_connect (GTK_OBJECT (window), "delete_event",
		      GTK_SIGNAL_FUNC (gtk_exit), NULL);

  /* Initialization of the main hbox, and the 2 sub vboxes.
   */
  main_hbox = gtk_hbox_new (FALSE, 0);
  vbox1 = gtk_vbox_new (FALSE, 0);
  vbox2 = gtk_vbox_new (FALSE, 0);

  /* Menu stuff, initialization, and showing
   */
  menu = gtk_menu_new();
  root_menu = gtk_menu_item_new_with_label ("File");
  gtk_widget_show (root_menu);
  menu_items = gtk_menu_item_new_with_label ("New");
  menu_items = gtk_menu_item_new_with_label ("Open/Load");
  menu_items = gtk_menu_item_new_with_label ("Save");
  menu_items = gtk_menu_item_new_with_label ("Save as...");
  menu_items = gtk_menu_item_new_with_label ("Exit");
  gtk_menu_append (GTK_MENU (menu), menu_items);
  gtk_widget_show (menu_items);
  gtk_menu_item_set_submenu(GTK_MENU_ITEM (root_menu), menu);
  menu_bar = gtk_menu_bar_new();
  gtk_box_pack_start (GTK_BOX(vbox1), menu_bar, FALSE, FALSE, 0);
  gtk_widget_show (menu_bar);
  gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), root_menu);
  
  /* Scrolled window, initialization, configuration etc.
   */
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
				  GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
  gtk_box_pack_start (GTK_BOX(vbox1), scrolled_window, FALSE, FALSE, 0);
  gtk_widget_show (scrolled_window);

  gtk_box_pack_start (GTK_BOX(main_hbox), vbox1, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX(main_hbox), vbox2, FALSE, FALSE, 0);
  gtk_container_add (GTK_CONTAINER(window), main_hbox);

  gtk_widget_show (vbox1);
  gtk_widget_show (vbox2);
  gtk_widget_show (main_hbox);
  gtk_widget_show (window);
}

I compiled it with a gcc -c main_window.c -o main_window.o

and the error was, In function main_window, GtkWidget undeclared
function ( Each undeclared function is mentioned only once), I dunno
whats wrong with the code, and there are prolly a million other problems
with it, but its only somekind of a GTk excercise 'cause I'm trying to
learn GTK. thanks



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