title: Gtk-WARNING **: Could not find signal handler
body: <p>I created very simple GTK+ GUI with Glade, which includes one toggle button. I want to assign action to this button. I have a problem with getting the signal handler for the button to work. After compiling and running I get this message:</p>
  
  <blockquote>
    <p>Gtk-WARNING **: Could not find signal handler
    'on_togglebutton1_toggled'.  Did you compile with -rdynamic?</p>
  </blockquote>
  
  <p>My current C code looks like this:</p>
  
  <pre><code>#include &lt;gtk/gtk.h&gt;
  #include &lt;stdio.h&gt; 
  #include "f_back.h"
  
  #define UI_FILE "gui.ui"
  
  GtkWidget * create_window( void )
  {
      GtkWidget * window;
      GtkBuilder * builder;
      GError * error = NULL;
  
      builder = gtk_builder_new();
      if( !gtk_builder_add_from_file( builder, UI_FILE, &amp; error ) )
      {
          g_warning( "Can't load builder file: %s", error-&gt;message );
          g_error_free( error );
      }    
  
      gtk_builder_connect_signals( builder, NULL );
  
      window = GTK_WIDGET( gtk_builder_get_object( builder, "window1" ) );
  
      g_object_unref( builder );
  
      return window;
  }
  
  
  int
  main( int argc, char * argv[] )
  {
      GtkWidget * window;
  
      gtk_init( &amp; argc, &amp; argv );
  
      okno = create_window();
      gtk_widget_show( window );
      gtk_main()
  
      return 0;
  }
  </code></pre>
  
  <p>f_back.h:</p>
  
  <pre><code>#include &lt;gtk/gtk.h&gt;
  
  void on_togglebutton1_toggled( GtkToggleButton * togglebutton, gpointer user_data );
  </code></pre>
  
  <p>f_back.c:</p>
  
  <pre><code>#include "f_back.h"
  
  void on_togglebutton1_toggled( GtkToggleButton * togglebutton, gpointer user_data )
  {
      g_print( "Toggle button pressed\n" );
  }
  </code></pre>
  
  <p>GTK+ UI:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- Generated with glade 3.18.3 --&gt;
  &lt;interface&gt;
    &lt;requires lib="gtk+" version="3.12"/&gt;
    &lt;object class="GtkWindow" id="window1"&gt;
      &lt;property name="can_focus"&gt;False&lt;/property&gt;
      &lt;property name="title" translatable="yes"&gt;Testowe&lt;/property&gt;
      &lt;property name="window_position"&gt;center&lt;/property&gt;
      &lt;signal name="destroy" handler="gtk_main_quit" swapped="no"/&gt;
      &lt;child&gt;
        &lt;object class="GtkGrid" id="grid1"&gt;
          &lt;property name="visible"&gt;True&lt;/property&gt;
          &lt;property name="can_focus"&gt;False&lt;/property&gt;
          &lt;property name="row_homogeneous"&gt;True&lt;/property&gt;
          &lt;property name="column_homogeneous"&gt;True&lt;/property&gt;
          &lt;child&gt;
            &lt;object class="GtkImage" id="image1"&gt;
              &lt;property name="name"&gt;logo&lt;/property&gt;
              &lt;property name="visible"&gt;True&lt;/property&gt;
              &lt;property name="can_focus"&gt;False&lt;/property&gt;
              &lt;property name="yalign"&gt;0.10000000149011612&lt;/property&gt;
              &lt;property name="pixbuf"&gt;logo_large.bmp&lt;/property&gt;
              &lt;style&gt;
                &lt;class name="logo"/&gt;
              &lt;/style&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name="left_attach"&gt;0&lt;/property&gt;
              &lt;property name="top_attach"&gt;0&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
          &lt;child&gt;
            &lt;object class="GtkToggleButton" id="togglebutton1"&gt;
              &lt;property name="label" translatable="yes"&gt;LED ON/OFF&lt;/property&gt;
              &lt;property name="visible"&gt;True&lt;/property&gt;
              &lt;property name="can_focus"&gt;True&lt;/property&gt;
              &lt;property name="receives_default"&gt;True&lt;/property&gt;
              &lt;signal name="toggled" handler="on_togglebutton1_toggled" swapped="no"/&gt;
            &lt;/object&gt;
            &lt;packing&gt;
              &lt;property name="left_attach"&gt;0&lt;/property&gt;
              &lt;property name="top_attach"&gt;1&lt;/property&gt;
            &lt;/packing&gt;
          &lt;/child&gt;
          &lt;child&gt;
            &lt;placeholder/&gt;
          &lt;/child&gt;
          &lt;style&gt;
            &lt;class name="grid"/&gt;
          &lt;/style&gt;
        &lt;/object&gt;
      &lt;/child&gt;
    &lt;/object&gt;
  &lt;/interface&gt;
  </code></pre>
  
  <p>I've tried many options described on forums:</p>
  
  <ul>
  <li>compiling with -rdynamic,</li>
  <li>compiling with -export-dynamic,</li>
  <li>compiling with -lgmodule-2.0,</li>
  <li>adding gmodule-export-2.0 library.</li>
  <li>adding extern "C" before function declaration,</li>
  <li>using G_MODULE_EXPORT.</li>
  </ul>
  
  <p>None of these solutions worked. I always get the same message.</p>
  
  <p>My current Geany build commands:</p>
  
  <blockquote>
    <p>g++ -Wall -c "%f" -l wiringPi <code>pkg-config --cflags gtk+-3.0 --libs
    gtk+-3.0 gmodule-export-2.0</code> -rdynamic -export-dynamic -lgmodule-2.0</p>
    
    <p>g++ -Wall -o "%e" "%f" -l wiringPi <code>pkg-config --cflags gtk+-3.0
    --libs gtk+-3.0 gmodule-export-2.0</code> -rdynamic -export-dynamic -lgmodule-2.0</p>
  </blockquote>
  
  <p>Does anybody knows what's wrong with my code?</p>