Unable to compile gtk4 program in windows

I feel installation of gtk4 is proper as I am seeing below :

DELL@Lokesh-Windows MSYS ~
$ echo `pkg-config --cflags --libs gtk4`
-I/mingw64/include/gtk-4.0 -I/mingw64/include/pango-1.0 -I/mingw64/include/harfbuzz -I/mingw64/include/gdk-pixbuf-2.0 -I/mingw64/include/cairo -I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include -I/mingw64/include/freetype2 -I/mingw64/include/graphene-1.0 -I/mingw64/lib/graphene-1.0/include -mfpmath=sse -msse -msse2 -I/mingw64/include -I/mingw64/include/fribidi -I/mingw64/include/webp -DLIBDEFLATE_DLL -I/mingw64/include/libpng16 -I/mingw64/include/pixman-1 -L/mingw64/lib -lgtk-4 -lpangowin32-1.0 -lharfbuzz -lpangocairo-1.0 -lpango-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgraphene-1.0 -lgio-2.0 -lglib-2.0 -lintl -lgobject-2.0

Program is as follows :

DELL@Lokesh-Windows MSYS ~
$ cat one.c
#include <gtk/gtk.h>

static void activate( GtkApplication *app, gpointer argv )
{
        GtkWidget *main_window = gtk_application_window_new( app );
        gtk_window_set_title( (GtkWindow*)main_window, "This is for Testing" );
        gtk_window_set_default_size( (GtkWindow*)main_window, 200, 200 );
        gtk_widget_show( main_window );
}

int main( const int argc, char * argv[] )
{
        GtkApplication * const app = gtk_application_new( "One.Gui", 0 );
        if( g_signal_connect( app, "activate", G_CALLBACK( activate ), argv ) <= 0 )
        {
                fprintf( stderr, "Unable to connect activate event\n" );
                exit( 0 );
        }
        int status = g_application_run( G_APPLICATION( app ), 0, NULL );
        g_object_unref( app );

        return status;
}

DELL@Lokesh-Windows MSYS ~
$

If I compile the program, I’m seeing the following error :


DELL@Lokesh-Windows MSYS ~
$ gcc  `pkg-config --cflags --libs gtk4` one.c
In file included from /mingw64/include/_cygwin.h:14,
                 from /mingw64/include/_mingw.h:15,
                 from /mingw64/include/corecrt.h:10,
                 from /mingw64/include/crtdefs.h:10,
                 from /mingw64/include/stddef.h:7,
                 from /mingw64/include/glib-2.0/glib/gmacros.h:40,
                 from /mingw64/lib/glib-2.0/include/glibconfig.h:9,
                 from /mingw64/include/glib-2.0/glib/gtypes.h:34,
                 from /mingw64/include/glib-2.0/glib/galloca.h:34,
                 from /mingw64/include/glib-2.0/glib.h:32,
                 from /mingw64/include/gtk-4.0/gtk/css/gtkcss.h:29,
                 from /mingw64/include/gtk-4.0/gtk/gtk.h:29,
                 from one.c:1:
/mingw64/include/stddef.h:18:10: error: expected ‘;’ before ‘extern’
   18 |   _CRTIMP extern int *__cdecl _errno(void);
      |          ^~~~~~~
      |          ;
/mingw64/include/stddef.h:20:3: warning: data definition has no type or storage class
   20 |   errno_t __cdecl _set_errno(int _Value);
      |   ^~~~~~~
/mingw64/include/stddef.h:20:3: warning: type defaults to ‘int’ in declaration of ‘errno_t’ [-Wimplicit-int]
/mingw64/include/stddef.h:20:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stddef.h:20:19: error: expected ‘,’ or ‘;’ before ‘_set_errno’
   20 |   errno_t __cdecl _set_errno(int _Value);
      |                   ^~~~~~~~~~
/mingw64/include/stddef.h:21:3: warning: data definition has no type or storage class
   21 |   errno_t __cdecl _get_errno(int *_Value);
      |   ^~~~~~~
/mingw64/include/stddef.h:21:3: warning: type defaults to ‘int’ in declaration of ‘errno_t’ [-Wimplicit-int]
/mingw64/include/stddef.h:21:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stddef.h:21:19: error: expected ‘,’ or ‘;’ before ‘_get_errno’
   21 |   errno_t __cdecl _get_errno(int *_Value);
      |                   ^~~~~~~~~~
/mingw64/include/stddef.h:24:10: error: expected ‘;’ before ‘extern’
   24 |   _CRTIMP extern unsigned long __cdecl __threadid(void);
      |          ^~~~~~~
      |          ;
/mingw64/include/stddef.h:26:10: error: expected ‘;’ before ‘extern’
   26 |   _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
      |          ^~~~~~~
      |          ;
/mingw64/include/stddef.h:26:18: warning: type defaults to ‘int’ in declaration of ‘uintptr_t’ [-Wimplicit-int]
   26 |   _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
      |                  ^~~~~~~~~
/mingw64/include/stddef.h:26:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
   26 |   _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
      |   ^~~~~~~
/mingw64/include/stddef.h:26:36: error: expected ‘,’ or ‘;’ before ‘__threadhandle’
   26 |   _CRTIMP extern uintptr_t __cdecl __threadhandle(void);
      |                                    ^~~~~~~~~~~~~~
/mingw64/include/corecrt.h:113:13: error: ‘errno_t’ redeclared as different kind of symbol
  113 | typedef int errno_t;
      |             ^~~~~~~
/mingw64/include/stddef.h:21:3: note: previous declaration of ‘errno_t’ with type ‘int’
   21 |   errno_t __cdecl _get_errno(int *_Value);
      |   ^~~~~~~
In file included from /mingw64/include/glib-2.0/glib/gtypes.h:41:
/mingw64/include/time.h:12:2: error: #error Only Win32 target is supported!
   12 | #error Only Win32 target is supported!
      |  ^~~~~
In file included from /mingw64/include/time.h:25:
/mingw64/include/sys/timeb.h:12:2: error: #error Only Win32 target is supported!
   12 | #error Only Win32 target is supported!
      |  ^~~~~
/mingw64/include/sys/timeb.h:62:5: error: unknown type name ‘time_t’
   62 |     time_t time;
      |     ^~~~~~
/mingw64/include/sys/timeb.h:102:3: error: unknown type name ‘time_t’
  102 |   time_t  tv_sec;   /* Seconds */
      |   ^~~~~~
/mingw64/include/time.h:216:34: error: unknown type name ‘time_t’
  216 |   wchar_t *__cdecl _wctime(const time_t *) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
      |                                  ^~~~~~
/mingw64/include/time.h:219:47: error: unknown type name ‘time_t’
  219 |   __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); }
      |                                               ^~~~~~
/mingw64/include/time.h: In function ‘_wctime’:
/mingw64/include/time.h:219:81: warning: passing argument 1 of ‘_wctime64’ from incompatible pointer type [-Wincompatible-pointer-types]
  219 |   __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); }
      |                                                                                 ^~~~~
      |                                                                                 |
      |                                                                                 const int *
/mingw64/include/time.h:211:56: note: expected ‘const __time64_t *’ {aka ‘const long long int *’} but argument is of type ‘const int *’
  211 |   _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
      |                                      ~~~~~~~~~~~~~~~~~~^~~~~
/mingw64/include/time.h: At top level:
/mingw64/include/time.h:228:54: error: unknown type name ‘time_t’
  228 |   errno_t __cdecl _wctime_s(wchar_t *, size_t, const time_t *);
      |                                                      ^~~~~~
/mingw64/include/time.h:231:86: error: unknown type name ‘time_t’
  231 |   __CRT_INLINE errno_t __cdecl _wctime_s (wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s (_Buffer,_SizeInWords,_Time); }
      |                                                                                      ^~~~~~
/mingw64/include/time.h: In function ‘_wctime_s’:
/mingw64/include/time.h:231:144: warning: passing argument 3 of ‘_wctime64_s’ from incompatible pointer type [-Wincompatible-pointer-types]
  231 |   __CRT_INLINE errno_t __cdecl _wctime_s (wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s (_Buffer,_SizeInWords,_Time); }
      |                                                                                                                                                ^~~~~
      |                                                                                                                                                |
      |                                                                                                                                                const int *
/mingw64/include/time.h:212:92: note: expected ‘const __time64_t *’ {aka ‘const long long int *’} but argument is of type ‘const int *’
  212 |   _SECIMP errno_t __cdecl _wctime64_s (wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time);
      |                                                                          ~~~~~~~~~~~~~~~~~~^~~~~
/mingw64/include/time.h: At top level:
/mingw64/include/time.h:258:17: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  258 | static __inline time_t __CRTDECL time(time_t *_Time) { return _time64(_Time); }
      |                 ^~~~~~
/mingw64/include/time.h:258:17: warning: variable ‘time_t’ declared ‘inline’
/mingw64/include/time.h:258:1: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
  258 | static __inline time_t __CRTDECL time(time_t *_Time) { return _time64(_Time); }
      | ^~~~~~
/mingw64/include/time.h:258:34: error: expected ‘,’ or ‘;’ before ‘time’
  258 | static __inline time_t __CRTDECL time(time_t *_Time) { return _time64(_Time); }
      |                                  ^~~~
/mingw64/include/time.h:262:43: error: expected declaration specifiers or ‘...’ before ‘time_t’
  262 | static __inline double __CRTDECL difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); }
      |                                           ^~~~~~
/mingw64/include/time.h:263:54: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  263 | static __inline struct tm *__CRTDECL localtime(const time_t *_Time) { return _localtime64(_Time); }
      |                                                      ^~~~~~
/mingw64/include/time.h:263:61: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
  263 | static __inline struct tm *__CRTDECL localtime(const time_t *_Time) { return _localtime64(_Time); }
      |                                                             ^
/mingw64/include/time.h:264:68: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  264 | static __inline errno_t __CRTDECL localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); }
      |                                                                    ^~~~~~
/mingw64/include/time.h:264:75: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
  264 | static __inline errno_t __CRTDECL localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); }
      |                                                                           ^
/mingw64/include/time.h:265:51: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  265 | static __inline struct tm *__CRTDECL gmtime(const time_t *_Time) { return _gmtime64(_Time); }
      |                                                   ^~~~~~
/mingw64/include/time.h:265:58: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
  265 | static __inline struct tm *__CRTDECL gmtime(const time_t *_Time) { return _gmtime64(_Time); }
      |                                                          ^
/mingw64/include/time.h:266:66: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  266 | static __inline errno_t __CRTDECL gmtime_s(struct tm *_Tm, const time_t *_Time) { return _gmtime64_s(_Tm, _Time); }
      |                                                                  ^~~~~~
/mingw64/include/time.h:266:73: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
  266 | static __inline errno_t __CRTDECL gmtime_s(struct tm *_Tm, const time_t *_Time) { return _gmtime64_s(_Tm, _Time); }
      |                                                                         ^
/mingw64/include/time.h:267:45: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  267 | static __inline char *__CRTDECL ctime(const time_t *_Time) { return _ctime64(_Time); }
      |                                             ^~~~~~
/mingw64/include/time.h:267:52: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
  267 | static __inline char *__CRTDECL ctime(const time_t *_Time) { return _ctime64(_Time); }
      |                                                    ^
/mingw64/include/time.h:268:80: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  268 | static __inline errno_t __CRTDECL ctime_s(char *_Buf,size_t _SizeInBytes,const time_t *_Time) { return _ctime64_s(_Buf,_SizeInBytes,_Time); }
      |                                                                                ^~~~~~
/mingw64/include/time.h:268:87: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token
  268 | static __inline errno_t __CRTDECL ctime_s(char *_Buf,size_t _SizeInBytes,const time_t *_Time) { return _ctime64_s(_Buf,_SizeInBytes,_Time); }
      |                                                                                       ^
/mingw64/include/time.h:269:17: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  269 | static __inline time_t __CRTDECL mktime(struct tm *_Tm) { return _mktime64(_Tm); }
      |                 ^~~~~~
/mingw64/include/time.h:269:17: warning: variable ‘time_t’ declared ‘inline’
/mingw64/include/time.h:269:1: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
  269 | static __inline time_t __CRTDECL mktime(struct tm *_Tm) { return _mktime64(_Tm); }
      | ^~~~~~
/mingw64/include/time.h:270:17: warning: type defaults to ‘int’ in declaration of ‘time_t’ [-Wimplicit-int]
  270 | static __inline time_t __CRTDECL _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); }
      |                 ^~~~~~
/mingw64/include/time.h:270:34: error: expected ‘,’ or ‘;’ before ‘_mkgmtime’
  270 | static __inline time_t __CRTDECL _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); }
      |                                  ^~~~~~~~~
In file included from /mingw64/include/stdarg.h:140,
                 from /mingw64/include/glib-2.0/glib/gerror.h:28,
                 from /mingw64/include/glib-2.0/glib/gthread.h:35,
                 from /mingw64/include/glib-2.0/glib/gasyncqueue.h:34,
                 from /mingw64/include/glib-2.0/glib.h:34:
/mingw64/include/_mingw_stdarg.h:11:2: error: #error Only Win32 target is supported!
   11 | #error Only Win32 target is supported!
      |  ^~~~~
In file included from /mingw64/include/glib-2.0/glib.h:39:
/mingw64/include/glib-2.0/glib/gbookmarkfile.h:231:53: error: expected declaration specifiers or ‘...’ before ‘time_t’
  231 |                                                     time_t         *stamp,
      |                                                     ^~~~~~
/mingw64/include/glib-2.0/glib/gbookmarkfile.h:263:53: error: expected declaration specifiers or ‘...’ before ‘time_t’
  263 |                                                     time_t          added);
      |                                                     ^~~~~~
/mingw64/include/glib-2.0/glib/gbookmarkfile.h:269:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘g_bookmark_file_get_added’
  269 | time_t         g_bookmark_file_get_added           (GBookmarkFile  *bookmark,
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
/mingw64/include/glib-2.0/glib/gbookmarkfile.h:279:53: error: expected declaration specifiers or ‘...’ before ‘time_t’
  279 |                                                     time_t          modified);
      |                                                     ^~~~~~
/mingw64/include/glib-2.0/glib/gbookmarkfile.h:285:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘g_bookmark_file_get_modified’
  285 | time_t         g_bookmark_file_get_modified        (GBookmarkFile  *bookmark,
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mingw64/include/glib-2.0/glib/gbookmarkfile.h:295:53: error: expected declaration specifiers or ‘...’ before ‘time_t’
  295 |                                                     time_t          visited);
      |                                                     ^~~~~~
/mingw64/include/glib-2.0/glib/gbookmarkfile.h:301:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘g_bookmark_file_get_visited’
  301 | time_t         g_bookmark_file_get_visited         (GBookmarkFile  *bookmark,
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /mingw64/include/glib-2.0/glib.h:45:
/mingw64/include/glib-2.0/glib/gdate.h:190:44: error: expected declaration specifiers or ‘...’ before ‘time_t’
  190 |                                            time_t       timet);
      |                                            ^~~~~~
In file included from /mingw64/include/glib-2.0/glib/gtestutils.h:33,
                 from /mingw64/include/glib-2.0/glib.h:89:
/mingw64/include/stdlib.h:148:115: error: expected declaration specifiers or ‘...’ before ‘uintptr_t’
  148 |   typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t);
      |                                                                                                                   ^~~~~~~~~
/mingw64/include/stdlib.h:149:11: warning: type defaults to ‘int’ in declaration of ‘_invalid_parameter_handler’ [-Wimplicit-int]
  149 |   _CRTIMP _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~
/mingw64/include/stdlib.h:149:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
  149 |   _CRTIMP _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler);
      |   ^~~~~~~
/mingw64/include/stdlib.h:149:46: error: expected ‘,’ or ‘;’ before ‘_set_invalid_parameter_handler’
  149 |   _CRTIMP _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler);
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mingw64/include/stdlib.h:150:11: warning: type defaults to ‘int’ in declaration of ‘_invalid_parameter_handler’ [-Wimplicit-int]
  150 |   _CRTIMP _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~
/mingw64/include/stdlib.h:150:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
  150 |   _CRTIMP _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
      |   ^~~~~~~
/mingw64/include/stdlib.h:150:46: error: expected ‘,’ or ‘;’ before ‘_get_invalid_parameter_handler’
  150 |   _CRTIMP _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /mingw64/include/stdlib.h:770:
/mingw64/include/malloc.h:112:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
  112 |   _CRTIMP intptr_t __cdecl _get_heap_handle(void);
      |           ^~~~~~~~
/mingw64/include/malloc.h:112:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
  112 |   _CRTIMP intptr_t __cdecl _get_heap_handle(void);
      |   ^~~~~~~
/mingw64/include/malloc.h:112:28: error: expected ‘,’ or ‘;’ before ‘_get_heap_handle’
  112 |   _CRTIMP intptr_t __cdecl _get_heap_handle(void);
      |                            ^~~~~~~~~~~~~~~~
In file included from /mingw64/include/pango-1.0/pango/pango-utils.h:25,
                 from /mingw64/include/pango-1.0/pango/pango.h:51,
                 from /mingw64/include/gtk-4.0/gdk/gdktypes.h:37,
                 from /mingw64/include/gtk-4.0/gdk/gdkapplaunchcontext.h:27,
                 from /mingw64/include/gtk-4.0/gdk/gdk.h:29,
                 from /mingw64/include/gtk-4.0/gtk/gtk.h:30:
/mingw64/include/stdio.h:1349:3: warning: data definition has no type or storage class
 1349 |   wint_t __cdecl fgetwc(FILE *_File);
      |   ^~~~~~
/mingw64/include/stdio.h:1349:3: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
/mingw64/include/stdio.h:1349:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stdio.h:1349:18: error: expected ‘,’ or ‘;’ before ‘fgetwc’
 1349 |   wint_t __cdecl fgetwc(FILE *_File);
      |                  ^~~~~~
/mingw64/include/stdio.h:1350:11: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
 1350 |   _CRTIMP wint_t __cdecl _fgetwchar(void);
      |           ^~~~~~
/mingw64/include/stdio.h:1350:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1350 |   _CRTIMP wint_t __cdecl _fgetwchar(void);
      |   ^~~~~~~
/mingw64/include/stdio.h:1350:26: error: expected ‘,’ or ‘;’ before ‘_fgetwchar’
 1350 |   _CRTIMP wint_t __cdecl _fgetwchar(void);
      |                          ^~~~~~~~~~
/mingw64/include/stdio.h:1351:3: warning: data definition has no type or storage class
 1351 |   wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
      |   ^~~~~~
/mingw64/include/stdio.h:1351:3: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
/mingw64/include/stdio.h:1351:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stdio.h:1351:3: warning: ‘wint_t’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
/mingw64/include/stdio.h:1351:18: error: expected ‘,’ or ‘;’ before ‘fputwc’
 1351 |   wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File);
      |                  ^~~~~~
/mingw64/include/stdio.h:1352:11: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
 1352 |   _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
      |           ^~~~~~
/mingw64/include/stdio.h:1352:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1352 |   _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
      |   ^~~~~~~
/mingw64/include/stdio.h:1352:26: error: expected ‘,’ or ‘;’ before ‘_fputwchar’
 1352 |   _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch);
      |                          ^~~~~~~~~~
/mingw64/include/stdio.h:1353:3: warning: data definition has no type or storage class
 1353 |   wint_t __cdecl getwc(FILE *_File);
      |   ^~~~~~
/mingw64/include/stdio.h:1353:3: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
/mingw64/include/stdio.h:1353:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stdio.h:1353:3: warning: ‘wint_t’ redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
/mingw64/include/stdio.h:1353:18: error: expected ‘,’ or ‘;’ before ‘getwc’
 1353 |   wint_t __cdecl getwc(FILE *_File);
      |                  ^~~~~
/mingw64/include/stdio.h:1354:3: warning: data definition has no type or storage class
 1354 |   wint_t __cdecl getwchar(void);
      |   ^~~~~~
/mingw64/include/stdio.h:1354:3: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
/mingw64/include/stdio.h:1354:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stdio.h:1354:18: error: expected ‘,’ or ‘;’ before ‘getwchar’
 1354 |   wint_t __cdecl getwchar(void);
      |                  ^~~~~~~~
/mingw64/include/stdio.h:1355:3: warning: data definition has no type or storage class
 1355 |   wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
      |   ^~~~~~
/mingw64/include/stdio.h:1355:3: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
/mingw64/include/stdio.h:1355:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stdio.h:1355:18: error: expected ‘,’ or ‘;’ before ‘putwc’
 1355 |   wint_t __cdecl putwc(wchar_t _Ch,FILE *_File);
      |                  ^~~~~
/mingw64/include/stdio.h:1356:3: warning: data definition has no type or storage class
 1356 |   wint_t __cdecl putwchar(wchar_t _Ch);
      |   ^~~~~~
/mingw64/include/stdio.h:1356:3: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
/mingw64/include/stdio.h:1356:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stdio.h:1356:18: error: expected ‘,’ or ‘;’ before ‘putwchar’
 1356 |   wint_t __cdecl putwchar(wchar_t _Ch);
      |                  ^~~~~~~~
/mingw64/include/stdio.h:1357:3: warning: data definition has no type or storage class
 1357 |   wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
      |   ^~~~~~
/mingw64/include/stdio.h:1357:3: warning: type defaults to ‘int’ in declaration of ‘wint_t’ [-Wimplicit-int]
/mingw64/include/stdio.h:1357:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
/mingw64/include/stdio.h:1357:18: error: expected ‘,’ or ‘;’ before ‘ungetwc’
 1357 |   wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File);
      |                  ^~~~~~~
/mingw64/include/stdio.h:1607:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
 1607 |   _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |           ^~~~~~~~
/mingw64/include/stdio.h:1607:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1607 |   _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |   ^~~~~~~
/mingw64/include/stdio.h:1607:28: error: expected ‘,’ or ‘;’ before ‘_wspawnl’
 1607 |   _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |                            ^~~~~~~~
/mingw64/include/stdio.h:1608:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
 1608 |   _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |           ^~~~~~~~
/mingw64/include/stdio.h:1608:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1608 |   _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |   ^~~~~~~
/mingw64/include/stdio.h:1608:28: error: expected ‘,’ or ‘;’ before ‘_wspawnle’
 1608 |   _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |                            ^~~~~~~~~
/mingw64/include/stdio.h:1609:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
 1609 |   _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |           ^~~~~~~~
/mingw64/include/stdio.h:1609:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1609 |   _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |   ^~~~~~~
/mingw64/include/stdio.h:1609:28: error: expected ‘,’ or ‘;’ before ‘_wspawnlp’
 1609 |   _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |                            ^~~~~~~~~
/mingw64/include/stdio.h:1610:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
 1610 |   _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |           ^~~~~~~~
/mingw64/include/stdio.h:1610:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1610 |   _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |   ^~~~~~~
/mingw64/include/stdio.h:1610:28: error: expected ‘,’ or ‘;’ before ‘_wspawnlpe’
 1610 |   _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
      |                            ^~~~~~~~~~
/mingw64/include/stdio.h:1611:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
 1611 |   _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
      |           ^~~~~~~~
/mingw64/include/stdio.h:1611:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1611 |   _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
      |   ^~~~~~~
/mingw64/include/stdio.h:1611:28: error: expected ‘,’ or ‘;’ before ‘_wspawnv’
 1611 |   _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
      |                            ^~~~~~~~
/mingw64/include/stdio.h:1612:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
 1612 |   _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
      |           ^~~~~~~~
/mingw64/include/stdio.h:1612:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1612 |   _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
      |   ^~~~~~~
/mingw64/include/stdio.h:1612:28: error: expected ‘,’ or ‘;’ before ‘_wspawnve’
 1612 |   _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
      |                            ^~~~~~~~~
/mingw64/include/stdio.h:1613:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1613 |   _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
      |   ^~~~~~~
/mingw64/include/stdio.h:1613:28: error: expected ‘,’ or ‘;’ before ‘_wspawnvp’
 1613 |   _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
      |                            ^~~~~~~~~
/mingw64/include/stdio.h:1614:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
 1614 |   _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
      |           ^~~~~~~~
/mingw64/include/stdio.h:1614:3: warning: ‘cdecl’ attribute only applies to function types [-Wattributes]
 1614 |   _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
      |   ^~~~~~~
/mingw64/include/stdio.h:1614:28: error: expected ‘,’ or ‘;’ before ‘_wspawnvpe’
 1614 |   _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
      |                            ^~~~~~~~~~
/mingw64/include/stdio.h:1631:11: warning: type defaults to ‘int’ in declaration of ‘intptr_t’ [-Wimplicit-int]
 1631 |   _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList);
      |           ^~~~~~~~
one.c: In function ‘activate’:
one.c:8:9: warning: ‘gtk_widget_show’ is deprecated: Use 'gtk_widget_set_visible or gtk_window_present' instead [-Wdeprecated-declarations]
    8 |         gtk_widget_show( main_window );
      |         ^~~~~~~~~~~~~~~
In file included from /mingw64/include/gtk-4.0/gtk/gtkapplication.h:26,
                 from /mingw64/include/gtk-4.0/gtk/gtkwindow.h:32,
                 from /mingw64/include/gtk-4.0/gtk/gtkaboutdialog.h:29,
                 from /mingw64/include/gtk-4.0/gtk/gtk.h:33:
/mingw64/include/gtk-4.0/gtk/gtkwidget.h:271:12: note: declared here
  271 | void       gtk_widget_show                (GtkWidget           *widget);
      |            ^~~~~~~~~~~~~~~


Can someone help me identifying where I’m doing wrong please … ?

Hi,

How have you installed gcc and gtk4?
Have you followed the recommended MSYS2 instructions?

By the way, the gcc flags are not passed properly: the --libs ones must be after the filename:

gcc  `pkg-config --cflags gtk4` one.c `pkg-config --libs gtk4`

otherwise you will face link errors.

(this command compiles successfully on my PC)

hi,

I feel I’ve followed the instructions correctly because pkg-config is not giving any error.

$ echo $PKG_CONFIG_PATH
/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig:/mingw64/lib/pkgconfig/


DELL@Lokesh-Windows MSYS ~
$ echo `pkg-config --cflags --libs gtk4`
-I/mingw64/include/gtk-4.0 -I/mingw64/include/pango-1.0 -I/mingw64/include/harfbuzz -I/mingw64/include/gdk-pixbuf-2.0 -I/mingw64/include/cairo -I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include -I/mingw64/include/freetype2 -I/mingw64/include/graphene-1.0 -I/mingw64/lib/graphene-1.0/include -mfpmath=sse -msse -msse2 -I/mingw64/include -I/mingw64/include/fribidi -I/mingw64/include/webp -DLIBDEFLATE_DLL -I/mingw64/include/libpng16 -I/mingw64/include/pixman-1 -L/mingw64/lib -lgtk-4 -lpangowin32-1.0 -lharfbuzz -lpangocairo-1.0 -lpango-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lcairo -lgraphene-1.0 -lgio-2.0 -lglib-2.0 -lintl -lgobject-2.0

hmm… your $PKG_CONFIG_PATH looks suspicious…

Looks like you’re using the MSYS terminal, which is not a mingw one but cygwin…
Can you please try from mingw64.exe instead?

Thanks.
solved.
I’m using MSYS2 terminal
after using mingw64.exe, it is working fine

1 Like