[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Structs
- From: Keith Welker <res06ypf gte net>
- To: "Josh 'Gage'" <antgage apk net>, gtk-app-devel-list gnome org
- Subject: Re: Structs
- Date: Mon, 30 Oct 2000 20:22:41 -0500
You have not declared any memory. Try this instead:
struct_t struct;
struct_t.widget1 = gtk_widget_new("useless widget 1");
struct_t.widget2 = gtk_widget_new("useless widget 2");
gtk_widget_show( struct_t.widget1 );
gtk_widget_show( struct_t.widget2 );
something along these lines should work
> Josh 'Gage' wrote:
>
> Hey guys.
>
> I'm trying to organize all my pertinent data widgets into a nice
> structure so that when I have to pass them around to functions it's
> easy on me(the programmer). I'm having a few problems tho...
>
> /***** Example Code */
> typedef struct
> {
> GtkWidget *widget1;
> GtkWidget *widget2;
> ...
> } struct_t;
>
> int main( int argc, char *argv[] )
> {
> struct_t *struct;
>
> struct_t->widget1 = gtk_widget_new("useless widget 1");
> struct_t->widget2 = gtk_widget_new("useless widget 2");
>
> gtk_widget_show( struct_t->widget1 );
> gtk_widget_show( struct_t->widget2 );
> ...
> g_print( "Quitting Program!\n" );
> return 0;
> }
> /***** End of Example Code */
>
> this is just a small piece of code, and as such is incomplete in the
> gtk+ api(no init, etc.). please ignore that :)
>
> When i try to compile this, ill usually get an error, and if i dont
> error the compile, i segfault on exit. Any help on this? I would
> REALLY like to organize my data, but this struct makes me want to hit
> it like a red headed step child :(
--
__
/ / Mandrake6.1 (2.2.14smp) | Keith Welker
/ / __ ____ __ __ __ __ | keith.welker@iname.com
/ /___ / / / _ \ / /_/ / \ \/ / | http://www.microcontroller.cc/
/_____/ /_/ /_/ /_/ /_____/ /_/\_\ | http://www.ent.ohiou.edu/~welker
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]