Search code examples
cwindowsgccglibpkg-config

How do i compile a glib application in windows withnout pkg-config?


I am trying to compile a glib application in windows 10, but i keep getting this error:

In file included from C:\Users\DamŔa\Desktop\C\glib-2.0/glibconfig.h:9,
                 from C:\Users\DamŔa\Desktop\C\glib-2.0/glib/gtypes.h:32,
                 from C:\Users\DamŔa\Desktop\C\glib-2.0/glib/galloca.h:32,
                 from C:\Users\DamŔa\Desktop\C\glib-2.0/glib.h:30,
                 from main.c:3:
C:\Users\DamŔa\Desktop\C\glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
C:\Users\DamŔa\Desktop\C\glib-2.0/glib/gmacros.h:818:31: error: static assertion failed: "Expression evaluates to false"
 #define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")
                               ^~~~~~~~~~~~~~
C:\Users\DamŔa\Desktop\C\glib-2.0/glib/gmacros.h:818:31: note: in definition of macro 'G_STATIC_ASSERT'
 #define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false")

while trying to compile it with this command:

gcc -I"C:\Users\Damča\Desktop\C\glib-2.0" main.c

I did some research and found out that it could be because i am not using pkg-config, but it doesn't work on windows, because it cant find the file glib-2.0.pc.

so, how can i compile it withnout pkg-config? or how do i make it work on windows?


Solution

  • The GLib source code for Linux won't work for Windows. Use the Windows version and try again. Set the environment variable PKG_CONFIG_PATH to the .pc file