Gtkmm, 4.0 Program terminate Error: Unhandled tag: <cambalache-project>

Hi, i am a beginner and trying a first Hello world project. Following the gtkmm 4 guide i get a basic app to work.

But when using a Cambalache gui definition file i get the error. Im using Fedora.

terminate called after throwing an instance of ‘Gtk::BuilderError’
what(): 4:1 Unhandled tag:

#include <gtkmm.h>

class MyWindow : public Gtk::Window
{
public:
    MyWindow();
};

MyWindow::MyWindow()
{
    set_title("Basic application");
}

int main(int argc, char *argv[])
{

    auto app {Gtk::Application::create("org.gtkmm.examples.base")};

    auto builder {Gtk::Builder::create_from_file("/home/ello/misc/CLionProjects/non_template/src/myui.cmb")};

    return app->make_window_and_run<MyWindow>(argc, argv);
}
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd">
<cambalache-project version="0.17.3" target_tk="gtk-4.0">
  <ui>
	(1,None,"hello world.ui","hello world.ui",None,None,None,None,None,None,None)
  </ui>
  <object>
	(1,1,"GtkWindow",None,None,None,None,None,-1,None,None)
  </object>
  <object_property>
	(1,1,"GtkWindow","default-height","400",None,None,None,None,None,None,None,None,None),
	(1,1,"GtkWindow","default-width","700",None,None,None,None,None,None,None,None,None)
  </object_property>
</cambalache-project>

You cannot use a Cambalache file with Gtk::Builder: they are not the same thing; the cmb file is a Cambalache project file.

You’ll need to tell Cambalache to generates the GtkBuilder XML, and then load that file.

yes, works!
I have some opinions on Cambalache…

Is there any alternatives?

You mean: are there other UI design tools for GTK4? The answer is, currently, no: there’s only Cambalache.

Many developers don’t use UI design tools, though, and write the UI by hand—either by writing UI templates, which are not supported by gtkmm; or by using Blueprint, which “compiles” to XML at build time.

If you have opinions about Cambalache, feel free to join the cambalache room on Matrix.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.