I’ve been using WSL 2 with Ubuntu.
So far, so good
The following works.
In the WSL/Ubuntu terminal:
$ x86_64-w64-mingw32-gcc -g -o hello hello.c
In CMD:
C:\Users\michiel>hello.exe
Hello world!
And this also works.
In the WSL/Ubuntu terminal:
$ gcc -o test main.c `pkg-config --libs --cflags gtk+-3.0`
$ ./test
This opens a basic (gtk) gui example.
The problem
$ x86_64-w64-mingw32-gcc -o main.exe main.c `pkg-config --libs --cflags gtk+-3.0`
output:
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/gtk-3.0/gdk/gdkconfig.h:13,
from /usr/include/gtk-3.0/gdk/gdk.h:30,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from main.c:1:
/usr/include/glib-2.0/glib/gtypes.h: In function ‘_GLIB_CHECKED_ADD_U64’:
/usr/include/glib-2.0/glib/gmacros.h:738:31: error: static assertion failed: "Expression evaluates to false"
738 | #define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
| ^~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gtypes.h:463:3: note: in expansion of macro ‘G_STATIC_ASSERT’
463 | G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
| ^~~~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/gio/gio.h:46,
from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28,
from /usr/include/gtk-3.0/gdk/gdk.h:32,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from main.c:1:
/usr/include/glib-2.0/gio/gcredentials.h: At top level:
/usr/include/glib-2.0/gio/gcredentials.h:75:1: error: unknown type name ‘uid_t’
75 | uid_t g_credentials_get_unix_user (GCredentials *credentials,
| ^~~~~
/usr/include/glib-2.0/gio/gcredentials.h:79:52: error: unknown type name ‘uid_t’; did you mean ‘pid_t’?
79 | uid_t uid,
| ^~~~~
| pid_t
I’ve also tried:
$ x86_64-w64-mingw32-gcc -o main.exe main.c `x86_64-w64-mingw32-pkg-config --libs --cflags gtk+-3.0`
Same result.
And I’ve installed more recent versions of the deb packages (than distributed by ubuntu for now): mingw-w64_8_ and mingw-w64-tools_8_ . This too gave the same result.
I installed MSYS2 and tried to change the PKG_CONFIG_PATH env variable but failed in doing so succesfully. I’m also not sure if this is the right course of action.
Can some kind spirit please help me with this frustrating issue?