Tutorial :What does “Unhandled Exception: GLib.GException: Unhandled tag: 'requires'” mean?



Question:

I'm trying to get my linux Gtk# application working on Windows. When I try to run it, I get this error message:

Unhandled Exception: GLib.GException: Unhandled tag: 'requires'

at Gtk.Builder.AddFromFile(String filename)

at Interface.MainWindow..ctor()

at [My Project Name].MainClass.Main(String[] args) in c:\Path\To\Main.cs:line 10

It seems to be happening when trying to build the interface from my Glade file. I've checked and the path to the glade file is correct. What might be going wrong?

Here is some code to reproduce the problem:

using System;  using Gtk;    namespace TestGtk {      class MainClass {          public static void Main (string[] args)          {              Application.Init();                string gladefile = @"C:\path\to\gladefile.glade";              Builder builder = new Builder();              builder.AddFromFile(gladefile);                Application.Run();          }      }  }  


Solution:1

You're using GtkBuilder to load GladeXML files. GtkBuilder has different XML format, incompatible with GladeXML (it more generic). If you use glade-3 to design your UI, you have an option to save as GtkBuilder XML or GladeXML. Also, glade has utility called gtk-builder-convert that you can use to convert GladeXML to GtkBuilder XML.

So, there are two options:

  1. Use glade-3 and save your UI in GtkBuilder format
  2. Use gtk-builder-convert utility


Solution:2

Strange... I don't know why on windows GTK# does not support requires. Anyway I'd try to remove the <requires ... /> tag from gladefile.glade.


Solution:3

This most likely means that your Glade file is corrupt or has got some weirdness in it.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »