Unable to connect signal and signal handler in Glade GTK+3

蓝咒 提交于 2019-12-05 12:41:44

Take a look at the gtk_builder_connect_signals() and gtk_builder_add_callback_symbol() documentation. Basically you need to either

  • use gtk_builder_add_callback_symbol() on all callbacks before connecting the signals or
  • link with gmodule-export-2.0 and use compile flags "-Wl,--export-dynamic" to export even unused symbols.

You can add more compiler settings with,

pkg-config --libs --cflags gmodule-2.0.

If anyone is building the program with meson, just add

gmoddep = dependency('gmodule-2.0')

to list of dependencies.

Add -rdynamic to export the function and make it visible to the loader.

> gcc pkg-config --cflags gtk+-3.0 -o kaczka kaczka.c pkg-config --libs gtk+-3.0

> ./kaczka

(kaczka:31686): Gtk-WARNING **: Could not find signal handler 'on_destroy'. Did you compile with -rdynamic?

> gcc pkg-config --cflags gtk+-3.0 -o kaczka kaczka.c pkg-config --libs gtk+-3.0 -rdynamic

> ./kaczka

No warning.

MingpeiZheng

I think your kaczka.glade maybe makes wrong.

I used your .c source file and created my own .glade, and it ran well.

What version of Glade are you trying?

Run the latest version and see if it solves the problem.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!