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

Back to archive index

Keith Marshall keith****@users*****
Thu Jun 28 00:37:25 JST 2018


On 27/06/18 01:06, David Gressett wrote:
> #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 wrong, and appears to be the cause of your issue.  Feature test
macros, such as UNICODE/_UNICODE in this case, *must* be defined
*before* any system header file, (or ideally *any* header file), is
included; here you delay the definition until after <_mingw.h> has been
included, by which time it is too late.

If I correct this, such that it becomes:

   #ifndef _MINGW32_H
   #define _MINGW32_H

   #ifndef RTX
   #define GNAT_UNICODE_SUPPORT
   #define _UNICODE /* For C runtime */
   #define UNICODE  /* For Win32 API */
   #endif

   #include <_mingw.h>

your example code compiles without error; without the correction, I see
the type incompatibility error as you report it.

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
Url : https://lists.osdn.me/mailman/archives/mingw-users/attachments/20180627/8e63d238/attachment.pgp 



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