[Mingw-users] Problems with compiling Windows system calls with MinGW gcc 6.3.0

Back to archive index

Eli Zaretskii eliz****@gnu*****
Thu Jun 28 00:59:25 JST 2018


> From: David Gressett <DGres****@amli-*****>
> Date: Tue, 26 Jun 2018 19:06:17 -0500
> 
> adaint.c: In function '__gnat_file_time_name_attr':
> adaint.c:21:39: warning: passing argument 1 of 'GetFileAttributesExA' 
> from incompatible pointer type [-Wincompatible-pointer-types]
>        if ((res = GetFileAttributesEx (wname, GetFileExInfoStandard, &fad)))
>                                        ^~~~~
> In file included from c:\mingw\include\windows.h:44:0,
>                  from mingw32.h:14,
>                  from adaint.c:5:
> c:\mingw\include\winbase.h:1728:24: note: expected 'LPCSTR 
> {aka const char *}' but argument is of type 'TCHAR *
>  {aka short unsigned int *}'
>  WINBASEAPI BOOL WINAPI GetFileAttributesExA

Like Earnie says: you cannot pass a 'TCHAR *' to GetFileAttributesExA.

> Here is the last one, mingw32.h,  27 lines of text:
> 
> #ifndef _MINGW32_H
> #define _MINGW32_H
> 
> #include <_mingw.h>
> 
> #ifndef RTX
> #define GNAT_UNICODE_SUPPORT
> #define _UNICODE /* For C runtime */
> #define UNICODE  /* For Win32 API */
> #endif

This is supposed to define UNICODE unless RTX is defined.  Does that
mean RTX is defined in your case?  Because if it doesn't, then UNICODE
should have become defined, and should have caused 'TCHAR *' and
LPCTSTR become the same, and should have also caused
GetFileAttributesEx resolve to GetFileAttributesExW, which does expect
wchar_t strings.

Which ones of these didn't work, and why?




More information about the MinGW-Users mailing list
Back to archive index