codeblockswindows-11gtkmm3

How to setup gtkmm3 from msys2 on codeblocks


I want to use gtkmm on Code::Blocks with g++. I used msys2 to install it. I checked whether the installation worked with some example code.

#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);
}

but it gave me this error. fatal error: gtkmm.h: No such file or directory I tried putting the pkg-config --cflags and --libs as compiler arguments but it still gave me the same error.

OS: Windows 11.

IDE: Code::Blocks 20.03.

msys2 version: 3.3.6-341.x86_64.


Solution

  • I found that the pkg-config I installed was for use with a Linux OS. I had used pacman -S pkg-config instead of pacman -S mingw-w64-x86_64-pkg-config in the MSYS2 terminal