PolteRGeisT
01-19-2003, 02:40 AM
This is the first GTK+ program I've written on my own, and I need help solving the runtime errors. I want to know if anyone else gets what I'm getting.
This is the command to compile:
gcc -Wall -o mattgtk mattgtk.c `gtk-config --libs --cflags`
and here is the program ( mattgtk.c )
#include <gtk/gtk.h>
void print_bye(GtkWindow *, gpointer);
int main( int argc, char **argv )
{
GtkWidget *label = gtk_label_new("Hellow Gewie World!");
GtkWidget *top_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *separator = gtk_hseparator_new();
GtkWidget *exit_button = gtk_button_new_with_label("Quit");
GtkWidget *box = gtk_vbox_new(FALSE, 10);
gtk_init( &argc, &argv );
gtk_widget_set_name(label, "PrimaryTopLevelText");
gtk_widget_set_name(top_window, "TopLevelWindow");
gtk_widget_set_name(separator, "TopLevelSeparator");
gtk_widget_set_name(exit_button, "TopLevelExit_button");
gtk_window_set_title(GTK_WINDOW(top_window), "Hello World from the title bar!");
gtk_container_set_border_width(GTK_CONTAINER(top_w indow), 15);
gtk_window_set_policy(GTK_WINDOW(top_window), FALSE, FALSE, FALSE);
gtk_signal_connect(GTK_OBJECT(exit_button), "clicked", print_bye, "Now leaving program\n");
gtk_container_add(GTK_CONTAINER(top_window), box);
gtk_box_pack_start_defaults(GTK_BOX(box), label);
gtk_box_pack_start_defaults(GTK_BOX(box), separator);
gtk_box_pack_start_defaults(GTK_BOX(box), exit_button);
/*gtk_widget_show(exit_button);
gtk_widget_show(separator);
gtk_widget_show(label);
gtk_widget_show(box);
gtk_widget_show(top_window);*/
gtk_widget_show_all(top_window);
gtk_main();
return 0;
}
void print_bye(GtkWindow *token_window, gpointer usr_data)
{
g_print(usr_data);
gtk_main_quit();
}
I won't paste the runtime errors here becuase there are a lot of them.
So please just tell me if you get any runtime errors. thanks.
This is the command to compile:
gcc -Wall -o mattgtk mattgtk.c `gtk-config --libs --cflags`
and here is the program ( mattgtk.c )
#include <gtk/gtk.h>
void print_bye(GtkWindow *, gpointer);
int main( int argc, char **argv )
{
GtkWidget *label = gtk_label_new("Hellow Gewie World!");
GtkWidget *top_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
GtkWidget *separator = gtk_hseparator_new();
GtkWidget *exit_button = gtk_button_new_with_label("Quit");
GtkWidget *box = gtk_vbox_new(FALSE, 10);
gtk_init( &argc, &argv );
gtk_widget_set_name(label, "PrimaryTopLevelText");
gtk_widget_set_name(top_window, "TopLevelWindow");
gtk_widget_set_name(separator, "TopLevelSeparator");
gtk_widget_set_name(exit_button, "TopLevelExit_button");
gtk_window_set_title(GTK_WINDOW(top_window), "Hello World from the title bar!");
gtk_container_set_border_width(GTK_CONTAINER(top_w indow), 15);
gtk_window_set_policy(GTK_WINDOW(top_window), FALSE, FALSE, FALSE);
gtk_signal_connect(GTK_OBJECT(exit_button), "clicked", print_bye, "Now leaving program\n");
gtk_container_add(GTK_CONTAINER(top_window), box);
gtk_box_pack_start_defaults(GTK_BOX(box), label);
gtk_box_pack_start_defaults(GTK_BOX(box), separator);
gtk_box_pack_start_defaults(GTK_BOX(box), exit_button);
/*gtk_widget_show(exit_button);
gtk_widget_show(separator);
gtk_widget_show(label);
gtk_widget_show(box);
gtk_widget_show(top_window);*/
gtk_widget_show_all(top_window);
gtk_main();
return 0;
}
void print_bye(GtkWindow *token_window, gpointer usr_data)
{
g_print(usr_data);
gtk_main_quit();
}
I won't paste the runtime errors here becuase there are a lot of them.
So please just tell me if you get any runtime errors. thanks.