【发布时间】:2011-02-24 16:15:00
【问题描述】:
正如标题已经说过的,我收到了一个我似乎无法修复的编译错误:
error: redefinition of 'tinygecko_notebook_get_type'
note: previous definition of 'tinygecko_notebook_get_type' was here
其中error指向这一行(这段代码的第一个sn-p):
GType
tinygecko_notebook_get_type (void)
{
static GType type = 0;
if (type == 0) {
static const GTypeInfo info = {
sizeof (TinygeckoNotebookClass), /* size of class struct */
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc)tinygecko_notebook_class_init, /* class_init */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (TinygeckoNotebook),
0, /* n_preallocs */
(GInstanceInitFunc)tinygecko_notebook_init /* instance_init */
};
type = g_type_register_static (GTK_TYPE_NOTEBOOK, "TinygeckoNotebook", &info, 0);
}
return type;
}
注释行指向类型设置
G_DEFINE_TYPE (TinygeckoNotebook, tinygecko_notebook, GTK_TYPE_NOTEBOOK);
两个 sn-ps 都位于 .c 文件中(note 行位于 error 行上方)。
帮助表示赞赏.. 我很困惑。为什么 gtk+ 宏要重新定义一个函数,我必须为自己的基于 gobject 的类初始化器和终结器(如果它们存在)(在本例中基于 GtkNotebook)设置。
【问题讨论】:
标签: c compiler-errors gtk gobject redefinition