Compiling GTK4 examples with msys2


I try to develop a multiplatform application using opengl, but for the while i’m really stuck.

I think examples will help me but i tried with gears and shadertoy and boy bring me errors.

I ask myself if i didn’t miss some things…

By example i tried with gears.
First it asked me a config.h i don’t know if it exists i just copied content from gtk-demo to files, i can’t find sources on my hard drive.

I created an empty config.h, sadly, because idk what to put inside.

I compile with "$ gcc $( pkg-config --cflags gtk4 epoxy) -o main.exe source.c gtkgears.c $( pkg-config --libs gtk4 epoxy)

but compilation failed with

D:/Programmes/x64/Programmation/MSYS2/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/13.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: D:/Programmes/x64/Programmation/MSYS2/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/13.2.0/…/…/…/…/lib/libmingw32.a(lib64_libmingw32_a-crtexe
win.o): in function main': C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexewin.c:67:(.text.startup+0xbd): undefined reference to WinMain’
collect2.exe: error: ld returned 1 exit status

By example, what is “source”, it’s a c code, isn’t it ?


mingw-w64-gtk4 is packaged and available in MSYS2, you can install it first.



Sorry, but it’s not all in relation with my question :confused:

Anyone else ?

The demos are not intended to be build separately, but altogether using gtk’s meson toolchain, so the missing config.h will be automatically generated during the build.

I think you should first try to edit gtkgears.c to make it independent from the whole gtk-demo. That will give you a good starting point for a standalone app example.

Thank a lot, I was wondering about this yesterday but it’s better to have confirmation because it will take some time.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.