specified class size for type `CatType' is smaller than the parent type's `GObject

来源:互联网 发布:seo外链招聘 编辑:程序博客网 时间:2024/05/13 21:27

编写了一个小小的Gobject程序,运行是出现错误:

(process:23258): GLib-GObject-WARNING **: specified class size for type `CatType' is smaller than the parent type's `GObject' class size
type = 0-----------------------------------g_type_register_static的返回为0

(process:23258): GLib-GObject-CRITICAL **: g_object_new: assertion `G_TYPE_IS_OBJECT (object_type)' failed


查了好久,突然发现原来错在:

struct _Cat
{
    GTypeInstance    parent;

    .......................

};


struct _CatClass
{
    GTypeClass        parent_class;

    ..........................

};


分别改成是:

struct _Cat
{
    GObject    parent;

    .......................

};


struct _CatClass
{
    GObjectClass        parent_class;

    ..........................

};


就好了

原创粉丝点击