Develop c++ application with bindings built by cppgir

Hello all,

I’m trying to build my first application with C++ and Gtk/Glib libraries.

I’ve chosen C++ as development language, because I want to learn this language and I think developing an application is a good way to get real experience with C++.

Currently, I’ve written some backend code to connect to my XMPP server. I’ve used the glibmm library to get bindings between c and c++ libraries and it works well :smiley: .

On the frontend side, I’m currently just creating a Gtk::Window with gtkmm.

Now, I want to replace the default Gtk::HeaderBar by a HdyHeaderBar as I’ve just learned about libhandy.

My problem is that, currently, there’s no “libhandymm” library to use and I can’t directly use the Gtk::Window::set_titlebar with a HdyHeaderBar pointer.

Well, libhandy is just one example of issue with manual bindings done by glibmm/gtkmm community. I expect to have more and more issue like this in the near future.

I wanted to know if some of you tried the cppgir tool to create automatically bindings with GObject Introspection ?

I’ve tried last year, but I failed. I don’t remember exactly why, but it was too complex for me to understand the cppgir documentation (since last year, there was not many commits).

I’ve certainly not understand how to build and use bindings, if you have some hint, any help will be appreciated :slight_smile:

I didn’t ever heard about cppgir because I don’t do c++, but for what it’s worth you can use libhandy by including its header with extern "C" { #include <cant_remember_libhandy_header.h>}, and using the C version of the functions.

Indeed I can do such include, but I loose the Oriented Object power of C++ :slight_smile:

I’ve already done such include for libsoup and libsecret and created manually a small C++ wrapper with it.

That’s sad to do so when we have the power of GObject Introspection available.

cppgir looks like a great project and I’d give it a try. Anyway you also have the option to wrap libraries with gmmproc.

Thanks I didn’t know this one, it will be a good way to help me if I can’t use cppgir.

I’ve just found one of my issues with cppgir was the Cflags key missing in the pkg-config system. That’s a first point fixed :smile:

I’ve seen too, there’s a make examples build target and that it doesn’t work with Debian Bullseye, but it seems to work with Ubuntu Bionic. As Mark Nauwelaerts seems active on, I’ll continue to open issues there.