title: gtkmm undefined reference to certain gtk::builder function add_from_file
body: <p>I am using eclipse, mingw-w64, gtkmm2.4, glade to compile some simple program.</p>
  
  <p>I can compile hello world gtkmm examples, following a tutorial to, however when it comes to glade came a little strange undefined to error.</p>
  
  <p>program that compiled and run smoothly, which was the gtkmm 2.24 simple example tutorial <a href="https://developer.gnome.org/gtkmm-tutorial/2.24/sec-basics-simple-example.html.en" rel="nofollow noreferrer">https://developer.gnome.org/gtkmm-tutorial/2.24/sec-basics-simple-example.html.en</a></p>
  
  <pre><code>#include &lt;gtkmm.h&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(int argc, char *argv[])
  {
      Gtk::Main kit(argc, argv);
      Gtk::Window window;
      Gtk::Main::run(*window);
      return 0;
  }
  </code></pre>
  
  <p>however when I try to run another simple example  from the glade chapter (24.2.1) things does not work out.</p>
  
  <p><a href="https://developer.gnome.org/gtkmm-tutorial/2.24/sec-builder-accessing-widgets.html.en" rel="nofollow noreferrer">https://developer.gnome.org/gtkmm-tutorial/2.24/sec-builder-accessing-widgets.html.en</a>
  example:</p>
  
  <pre><code>#include &lt;gtkmm.h&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(int argc, char *argv[])
  {
      Gtk::Main kit(argc, argv);
      //Gtk::Window window; //I changed it to fit with the glade example
  
      Gtk::Window* window;  //I changed this line from the example
  
      //////////////// this part was pretty much just copied out from the example//////
      Glib::RefPtr&lt;Gtk::Builder&gt; refBuilder = Gtk::Builder::create();
      try
        {
          refBuilder-&gt;add_from_file("something.glade"); //this is the line with problem.
        }
        catch(const Glib::FileError&amp; ex)
        {
          std::cerr &lt;&lt; "FileError: " &lt;&lt; ex.what() &lt;&lt; std::endl;
          return 1;
        }
        catch(const Gtk::BuilderError&amp; ex)
        {
          std::cerr &lt;&lt; "BuilderError: " &lt;&lt; ex.what() &lt;&lt; std::endl;
          return 1;
        }
      refBuilder-&gt;get_widget("window1", window);
      //////////////// end of copied out from the example//////
  
      Gtk::Main::run(*window);
      return 0;
  }
  </code></pre>
  
  <p>when compiled, it gave error as follow
  <code>test.cpp:(.text.startup+0x281): undefined reference to Gtk::Builder::add_from_file(std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)'</code></p>
  
  <p>It seems to take the argument "something.glade" as type <code>std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;</code> (which I have no idea what it is).</p>
  
  <p>according to the gtkmm manual (https:developer.gnome.org/gtkmm/stable/classGtk_1_1Builder.html#aa3f4af4e7eaf7861c8283dc0dbd5254c) seems it only takes <code>Gtk::Builder::add_from_file(const std::string &amp; filename)</code>. So is the argument type really the problem?</p>
  
  <p>I have tried casting it as std::string by doing <code>std::string()</code> or <code>string()</code>, but it gave the same error.</p>
  
  <p>I have tried commenting out the line in question, and it compiled fine.</p>
  
  <ul>
  <li><code>Gtk::Builder::create()</code> did not receive undefined reference to compilation error</li>
  <li><code>refBuilder-&gt;get_widget("window1", window);</code> did not receive undefined reference to compilation error</li>
  </ul>
  
  <p>So now I am scratching my head all over this seems trivial issue. Please provide some help.</p>
  
  <p>For more information</p>
  
  <ul>
  <li><code>pkg-config --cflags --libs</code> yielded <code>-IE:/gtkmm64/include/gtkmm-2.4 -IE:/gtkmm64/lib/gtkmm-2.4/include -IE:/gtkmm64/include/atkmm-1.6 -IE:/gtkmm64/include/giomm-2.4 -IE:/gtkmm64/lib/giomm-2.4/include -IE:/gtkmm64/include/pangomm-1.4 -IE:/gtkmm64/lib/pangomm-1.4/include -IE:/gtkmm64/include/gtk-2.0 -IE:/gtkmm64/include/gdkmm-2.4 -IE:/gtkmm64/lib/gdkmm-2.4/include -IE:/gtkmm64/include/atk-1.0 -IE:/gtkmm64/include/glibmm-2.4 -IE:/gtkmm64/lib/glibmm-2.4/include -IE:/gtkmm64/include/glib-2.0 -IE:/gtkmm64/lib/glib-2.0/include -IE:/gtkmm64/include/sigc++-2.0 -IE:/gtkmm64/lib/sigc++-2.0/include -IE:/gtkmm64/include/cairomm-1.0 -IE:/gtkmm64/lib/cairomm-1.0/include -IE:/gtkmm64/include/pango-1.0 -IE:/gtkmm64/include/cairo -IE:/gtkmm64/include -IE:/gtkmm64/include/freetype2 -IE:/gtkmm64/include/libpng14 -IE:/gtkmm64/lib/gtk-2.0/include -IE:/gtkmm64/include/gdk-pixbuf-2.0 -LE:/gtkmm64/lib -lgtkmm-2.4 -latkmm-1.6 -lgdkmm-2.4 -lgiomm-2.4 -lpangomm-1.4 -lgtk-win32-2.0 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpng14 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl</code>, Which I have included into the project</li>
  <li><code>pkg-config --modversion gtkmm2.4</code> yielded 2.22.0, so I doubt it has anything to do with the 2.14 requirement for add_from_file()</li>
  <li><code>pkg-config --modversion gtk+2.0</code> yielded 2.22.0</li>
  <li>I did not use any flags like <code>--std=c++xx</code>.</li>
  <li>windows 8 64bit</li>
  </ul>