I'm having issues getting gtkmm-4.0 to link on macOS Monterey.
I'm trying to compile this example program.
#include <gtkmm.h>
class MyWindow : public Gtk::Window {
public:
MyWindow();
};
MyWindow::MyWindow() {
set_title("Basic application");
set_default_size(200, 200);
}
int main(int argc, char* argv[]) {
auto app = Gtk::Application::create("org.gtkmm.examples.base");
return app->make_window_and_run<MyWindow>(argc, argv);
}
After trying to compile with g++-11 base.cc -o base `pkg-config gtkmm-4.0 --cflags --libs`
I get the following error:
Undefined symbols for architecture x86_64:
"__ZN3Gtk15ShortcutManager20add_controller_vfuncERKSt10shared_ptrINS_18ShortcutControllerEE", referenced from:
__ZTV8MyWindow in ccyzyk08.o
__ZTC8MyWindow0_N3Gtk6WindowE in ccyzyk08.o
__ZTC8MyWindow48_N3Gtk15ShortcutManagerE in ccyzyk08.o
"__ZN3Gtk15ShortcutManager23remove_controller_vfuncERKSt10shared_ptrINS_18ShortcutControllerEE", referenced from:
__ZTV8MyWindow in ccyzyk08.o
__ZTC8MyWindow0_N3Gtk6WindowE in ccyzyk08.o
__ZTC8MyWindow48_N3Gtk15ShortcutManagerE in ccyzyk08.o
"__ZN3Gtk6Widget14snapshot_vfuncERKSt10shared_ptrINS_8SnapshotEE", referenced from:
__ZTV8MyWindow in ccyzyk08.o
__ZTC8MyWindow0_N3Gtk6WindowE in ccyzyk08.o
__ZTC8MyWindow0_N3Gtk6WidgetE in ccyzyk08.o
"__ZN3Gtk6Widget16on_query_tooltipEiibRKSt10shared_ptrINS_7TooltipEE", referenced from:
__ZTV8MyWindow in ccyzyk08.o
__ZTC8MyWindow0_N3Gtk6WindowE in ccyzyk08.o
__ZTC8MyWindow0_N3Gtk6WidgetE in ccyzyk08.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
Does anyone know why these errors occur and how to fix them?
I'm using macOS Monterey on an Intel Mac.
I found a similar unanswered question from someone running macOS Monterey on arm64.
For reference, here is the output of `pkg-config gtkmm-4.0 --cflags --libs`
:
-mfpmath=sse -msse -msse2 -I/usr/local/Cellar/libffi/3.4.2/include -I/usr/local/Cellar/gtkmm4/4.6.0/include/gtkmm-4.0 -I/usr/local/Cellar/gtkmm4/4.6.0/lib/gtkmm-4.0/include -I/usr/local/Cellar/pangomm/2.50.0/include/pangomm-2.48 -I/usr/local/Cellar/pangomm/2.50.0/lib/pangomm-2.48/include -I/usr/local/Cellar/glibmm/2.70.0/include/giomm-2.68 -I/usr/local/Cellar/glibmm/2.70.0/lib/giomm-2.68/include -I/usr/local/Cellar/glibmm/2.70.0/include/glibmm-2.68 -I/usr/local/Cellar/glibmm/2.70.0/lib/glibmm-2.68/include -I/usr/local/Cellar/cairomm/1.16.1/include/cairomm-1.16 -I/usr/local/Cellar/cairomm/1.16.1/lib/cairomm-1.16/include -I/usr/local/Cellar/libsigc++/3.2.0/include/sigc++-3.0 -I/usr/local/Cellar/libsigc++/3.2.0/lib/sigc++-3.0/include -I/usr/local/Cellar/gtk4/4.6.1/include/gtk-4.0/unix-print -I/usr/local/Cellar/gtk4/4.6.1/include/gtk-4.0 -I/usr/local/Cellar/glib/2.70.4/include/gio-unix-2.0 -I/usr/local/Cellar/libepoxy/1.5.9_1/include -I/usr/local/Cellar/cairo/1.16.0_5/include/cairo -I/usr/local/Cellar/pango/1.50.5/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/4.0.1/include/harfbuzz -I/usr/local/Cellar/pango/1.50.5/include/pango-1.0 -I/usr/local/Cellar/fribidi/1.0.11/include/fribidi -I/usr/local/Cellar/harfbuzz/4.0.1/include/harfbuzz -I/usr/local/Cellar/graphite2/1.3.14/include -I/usr/local/Cellar/gdk-pixbuf/2.42.6/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.37/include/libpng16 -I/usr/local/Cellar/libtiff/4.3.0/include -I/usr/local/Cellar/cairo/1.16.0_5/include/cairo -I/usr/local/Cellar/pixman/0.40.0/include/pixman-1 -I/usr/local/Cellar/fontconfig/2.13.1/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libpng/1.6.37/include/libpng16 -I/usr/local/Cellar/libxcb/1.14_2/include -I/usr/local/Cellar/libxrender/0.9.10/include -I/usr/local/Cellar/libxext/1.3.4/include -I/usr/local/Cellar/libx11/1.7.3.1/include -I/usr/local/Cellar/libxcb/1.14_2/include -I/usr/local/Cellar/libxau/1.0.9/include -I/usr/local/Cellar/libxdmcp/1.1.3/include -I/usr/local/Cellar/graphene/1.10.6/include/graphene-1.0 -I/usr/local/Cellar/graphene/1.10.6/lib/graphene-1.0/include -I/usr/local/Cellar/glib/2.70.4/include -I/usr/local/Cellar/glib/2.70.4/include/glib-2.0 -I/usr/local/Cellar/glib/2.70.4/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.45/include -I/usr/local/Cellar/xorgproto/2021.5/include -L/usr/local/Cellar/gtkmm4/4.6.0/lib -L/usr/local/Cellar/pangomm/2.50.0/lib -L/usr/local/Cellar/glibmm/2.70.0/lib -L/usr/local/Cellar/cairomm/1.16.1/lib -L/usr/local/Cellar/libsigc++/3.2.0/lib -L/usr/local/Cellar/gtk4/4.6.1/lib -L/usr/local/Cellar/pango/1.50.5/lib -L/usr/local/Cellar/harfbuzz/4.0.1/lib -L/usr/local/Cellar/gdk-pixbuf/2.42.6/lib -L/usr/local/Cellar/cairo/1.16.0_5/lib -L/usr/local/Cellar/graphene/1.10.6/lib -L/usr/local/Cellar/glib/2.70.4/lib -L/usr/local/opt/gettext/lib -lgtkmm-4.0 -lpangomm-2.48 -lgiomm-2.68 -lglibmm-2.68 -lcairomm-1.16 -lsigc-3.0 -lgtk-4 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgraphene-1.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl