Re: g_object_new(G_TYPE_OBJECT,NULL) failed



On Monday 21 March 2005 15:43, Yueyu Lin wrote:

>  ...
>
> int 
> main (int argc,char *argv[]) 
> { 
>   g_print("hello\r\n");

You need to initialise the GObject type system here with a call to

      g_type_init ();

>   GObject *object = g_object_new(G_TYPE_OBJECT,NULL);

I don't think you can create an object of type GObject. It's a base class for 
deriving your own objects only, as far as I know.

>   g_free(object);

GObjects need to be freed with g_object_unref(), not g_free()

Cheers
 -Tim



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