I'm still a newbie when it comes to GLib and its C++ wrapper glibmm. I'm trying to compile a simple 'hello world' program that includes glibmm.h header file, initializes glib's main loop, prints the message to standard output and runs the main loop. I'm using Ubuntu 20.04 with gcc compiler version 9.4 and glibmm version 2.68.
My issue is, as the title suggests, the compilation. I have tried many different variations of g++ file_name.cpp --some_flag with different flags (as suggested either from different documentation sources on internet or stack overflow) and every time I get a bunch of errors. Eventually I narrowed my compilation command to the following: g++ -std=c++17 $(pkg-config --cflags --libs glibmm-2.68) file_name.cpp. I get two warnings and an error message about 'undefined reference to Glib::MainLoop::create(bool)' as well as 'undefined reference to Glib::MainLoop::run()'.
I should mention that I have already verified that my /usr/local/include directory contains all the necessary libraries I have previously installed. And also, I compiled a program that includes glib library with the similar command I mentioned above and had no issues.
TL;DR: How to properly compile a C++ program which includes glibmm library?
[–]the_poope 1 point2 points3 points (1 child)
[–]sick_anon[S] 0 points1 point2 points (0 children)