jhass / crystal-gobject

gobject-introspection for Crystal
BSD 3-Clause "New" or "Revised" License
127 stars 13 forks source link

error compiling samples "undefined fun 'window_get_type' for LibGtk" #13

Closed megatux closed 6 years ago

megatux commented 6 years ago
crystal build samples/gtk_hello_world.cr 
Error in samples/gtk_hello_world.cr:5: instantiating 'Gtk::Window#connect(String)'

window.connect "destroy", &->Gtk.main_quit
       ^~~~~~~

in src/g_object/object.cr:10: instantiating 'connect(String, Proc(Nil))'

      connect signal, callback
      ^~~~~~~

in src/g_object/object.cr:14: instantiating 'UInt64#tap()'

      LibGObject.signal_connect_data(to_unsafe.as(LibGObject::Object*),
                                                                        ^~~

in src/g_object/object.cr:14: instantiating 'UInt64#tap()'

      LibGObject.signal_connect_data(to_unsafe.as(LibGObject::Object*),
                                                                        ^~~

in src/g_object/object.cr:21: instantiating 'type_name()'

          raise ArgumentError.new("Couldn't connect signal #{signal} to #{type_name} (#{self.class})")
                                                                          ^~~~~~~~~

in src/g_object/object.cr:63: instantiating 'type()'

      GObject.type_name(type)
                        ^~~~

in src/generated/gtk/window.cr:157: undefined fun 'window_get_type' for LibGtk

      __return_value = LibGtk.window_get_type(to_unsafe.as(LibGtk::Window*))
                              ^~~~~~~~~~~~~~~

Even after running the generator, the "window_get_type" is not generated. To make it work I edited the files and added manually the line

fun window_get_type = gtk_window_get_type(this : Window*) : LibGdk::WindowType

libgtk3 version: 3.18.9-1ubuntu3.3 Crystal version 0.23.1 [e2a1389e8] (2017-07-13) LLVM 3.8.1