winbase.h uses the types ULONG_PTR and DWORD, which were not defined before.
I added the following to winbase.h to compile my program:
I don't think this is a bug in our headers. AFAIU the documentation on msdn, winbase.h is no header to be included by user directly. Instead windows.h or winnt.h should be used directly.
The other way - as you shown here - is to add at least basetsd.h + windef.h header before including it.
I am not sure how VC reacts here, so I put this bug to mode pending. If you can prove to us that VC includes those dependency-headers within winbase.h, then I am fine to add them.
OK, here is the long version of the problem:
When cross compiling with mingw-w64, libtool generates wrapper files for binaries (see for example the attached file lt-nfc-relay-picc.c). Those files directly include unistd.h, which includes winbase.h, which complains about missing types. It is correct, that including unistd.h directly is invalid for windows (see http://msdn.microsoft.com/en-us/library/ms811896.aspx\).
To some extent this indeed is not a bug of mingw but of libtool. However, winbase.h is simply inconsistent, when it uses types that are not declared in the scope of this file or its includes. I can't confirm if VC has the same inconsistency. But suppose it has, then you are fully compliant with VC. What you are doing is copying VC's bugs. If this is what you want, leave winbase.h as it is. If you want correctness, you might consider fixing this problem.
Wrapper file from libtool
Just out of curiosity. Could you provide to me preprocessed sources for the following file?
Compile it with gcc's options '-E -o t.i foo.c' and sent (or attach the t.i file please. I checked on my side and I can't find a place where winbase.h gets included by unistd.h header.
Sorry, I can't confirm this behavior.