GTKMM - Error compiling the hello world example

99 Views Asked by At

I am trying to build the hello world gtkmm example from the docs using the command

    -DLIBDEFLATE_DLL -IC:/msys64/mingw64/include/gtkmm-4.0 -IC:/msys64/mingw64/lib/gtkmm-4.0/include -IC:/msys64/mingw64/include/gtk-4.0 \
    -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include/graphene-1.0 \
    -IC:/msys64/mingw64/lib/graphene-1.0/include -IC:/msys64/mingw64/include/pangomm-2.48 \
    -IC:/msys64/mingw64/lib/pangomm-2.48/include -IC:/msys64/mingw64/include/giomm-2.68 \
    -IC:/msys64/mingw64/lib/giomm-2.68/include -IC:/msys64/mingw64/include/glibmm-2.68 \
    -IC:/msys64/mingw64/lib/glibmm-2.68/include -IC:/msys64/mingw64/include/cairomm-1.16 \
    -IC:/msys64/mingw64/lib/cairomm-1.16/include -IC:/msys64/mingw64/include/sigc++-3.0 \
    -IC:/msys64/mingw64/lib/sigc++-3.0/include -IC:/msys64/mingw64/include/pango-1.0 \
    -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/pango-1.0 \
    -IC:/msys64/mingw64/include/fribidi -IC:/msys64/mingw64/include/cairo \
    -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include/harfbuzz \
    -IC:/msys64/mingw64/include/pixman-1 -IC:/msys64/mingw64/include/gdk-pixbuf-2.0 \
    -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include/webp \
    -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include \
    -lgtkmm-4.0 -lgtk-4.0 -lpangowin32-1.0 -lcairo-gobject -lgraphene-1.0 -lpangomm-2.48 \
    -lgiomm-2.68 -lgio-2.0 -lglibmm-2.68 -lcairomm-1.16 -lsigc-3.0 -lpangocairo-1.0 -lpango-1.0 \
    -lharfbuzz -lcairo -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl

or

g++ -static -static-libgcc `pkg-config gtkmm-4 --cflags --libs` 

this resutls in the following errors

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgtk-4: No such file or directory
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgraphene-1.0: No such file or directory
collect2.exe: error: ld returned 1 exit status

according to this question I should add the path C:\msys64\mingw64\bin so i did but it did not help

I am using msys2 to compile this example

#include <gtkmm.h>

class Win : public Gtk::Window
{
    public:
        Win();
};

Win::Win()
{
    set_title("Hello world");
    set_default_size(500,500);
}

int main (int argc, char * argv[])
{
    auto app = Gtk::Application::create("org.gtkmm.examples.base");
    return app->make_window_and_run<Win>(argc, argv);
}

I did verify that gtk-4 and graphene are both installed and located the include and lib folders

0

There are 0 best solutions below