Re: gtk break the code into files programming question (fwd)



GtkWidget* make_menu() {
	GtkWidget* menuBar;
	...<details left out>...
	menuBar = gtk_menu_bar_new();
	...<details left out>...
	return menuBar;
}

parent {
	...
        menu_bar = GTK_MENU_BAR( make_menu() );
        gtk_container_add(GTK_CONTAINER(window), menu_bar);
        gtk_widget_show(window);
	...
}

Assume I have created the menu_bar correctly cause putting this all in a
file works correctly... trying to pass it back is where the problem comes
in, this is the error I recieve:

	gcc -c gscreen.c
	gscreen.c: In function `display_screen':
	gscreen.c:18: warning: assignment from incompatible pointer type

So if I change menu_bar to be of type GtkMenuBar the error becomes:

	gscreen.c: In function `display_screen':
	gscreen.c:19: warning: passing arg 2 of `gtk_container_add' from 
	incompatible pointer type

So if I change menu_bar to be of type GtkMenuBar* and cast arg2 of
container_add to (GtkWidget*) I get a flawless compile and a core dump. It
seems like the fix should be in this line:

	menu_bar = GTK_MENU_BAR( make_menu() );


Travis Loyd
[email: lelandg@usa.net							]
[  pgp: send email with subject: sendmepgp				]



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