Building glibmm 2.44 with VS2019

Does anyone know if glibmm 2.44 should be buildable with VC2019? I managed to build glib (2.54) a few weeks ago but if I create an empty source file and simply add the line #include “glibmm/main.h” VS2019 gives me hundreds of errors, such as:-

namespace 'std' has no member 'shared_ptr'
namespace 'std' has no member 'weak_ptr'
namespace 'std' has no member 'static_pointer_cast'
'void_t' is not a template
'basic_ostream' is not a template

and many others - or if this isn’t the right place for glibmm questions, can someone point me in the right direction? Many thanks,

John

[Edit…] I’ve just realised that glib 2.54 and glibmm 2.44 date back to 2017 and 2015 respectively (i.e. way before VS2019 came out). So are the current versions known to build with VS2019?

Hi John! Yes, you can build GLibmm with VS2019. The easiest way is to use vcpkg. Currently it has packages for GLib / GLibmm version 2.52.

Just as a side note: vcpkg is not supported by the upstream community, and the people that made vcpkg have made questionable decisions, like replacing the upstream build system with a custom one written using CMake, or not building everything that is needed to install and use GLib (and other G* libraries).

If you encounter issues with vcpkg, please file issues on the vcpkg issue tracker instead of the upstream one.

The recommended way to build GLib and GTK on Windows with the Visual Studio toolchain is to use gvsbuild.

1 Like

Many thanks guys - it turned out that this was only happening in one specific project so I’m just trying to track down why that one’s showing the problem when others are okay.

I’m happy to try alternative build systems but IIRC wasn’t meson involved at some stage? (I’m pretty sure it was for glib anyway). Meson could apparently generate VS build projects although they were quite limited (e.g. you could include either a Debug target or a Release target but not both). Has that all improved now or has meson been dropped in favour of one of these others?