Search code examples
c++includegtkmm

Undefined ustring in gtkmm 3.0


I'm in Code::Blocks, and for whatever reason, I cannot get started with gtkmm-3.0. Under Project -> Build options... -> Compiler settings --> Other options, I included the following...

`pkg-config gtkmm-3.0 --cflags --libs`
`pkg-config glibmm-2.4 --cflags --libs`

Obviously that should set everything up for using gtkmm-3.0 (which is indeed installed fully and properly), but I am getting errors from inside gtkmm-3.0.

/usr/include/gtkmm-2.4/gtkmm/papersize.h:37: undefined reference to Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:37: undefined reference to Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:38: undefined reference to Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:38: undefined reference to Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:39: undefined reference to Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:39: undefined reference to Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:40: undefined reference to Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:40: undefined reference to Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:41: undefined reference to Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:41: undefined reference to Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:42: undefined reference to Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:42: undefined reference to Glib::ustring::~ustring()' /usr/include/gtkmm-2.4/gtkmm/papersize.h:43: undefined reference to Glib::ustring::ustring(char const*)' /usr/include/gtkmm-2.4/gtkmm/papersize.h:43: undefined reference to Glib::ustring::~ustring()'

I do NOT want to switch to another IDE. I like CodeBlocks. How do I fix this?


Solution

  • Somehow, I figured this out. Go to Project --> Build options --> Linker settings. Under "Other linker options", put the following...

    `pkg-config gtkmm-3.0 --libs`
    `pkg-config glibmm-2.4 --libs`
    

    (Note, this is identical to the code in Compiler settings, except without --cflags. For me, that resolved the issue immediately.