winbase.h issue

JonY jon_y@users.sourceforge.net
Thu Sep 26 14:13:00 GMT 2013


On 9/26/2013 21:07, JonY wrote:
> On 9/26/2013 18:47, Noboru Uchida wrote:
>> When I try the following:
>>
>> $ echo "#include <windows.h>" >foo.cc && c++ -c foo.cc
>>
>> I get tons of redefinition errors on Interlocked functions in winbase.h.
>>
> 
> Looks like it happens only in C++ mode.
> 

Adding mingw-w64 list.
Here are some of the errors:

> /usr/include/w32api/winbase.h: In function ‘unsigned int _InterlockedIncrement(volatile unsigned int*)’:
> /usr/include/w32api/winbase.h:2925:33: error: redefinition of ‘unsigned int _InterlockedIncrement(volatile unsigned int*)’
>    FORCEINLINE unsigned __LONG32 InterlockedIncrement (unsigned __LONG32 volatile *Addend) { return (unsigned __LONG32) InterlockedIncrement ((volatile __LONG32 *) Addend); }
>                                  ^
> /usr/include/w32api/winbase.h:2924:24: error: ‘unsigned int _InterlockedIncrement(volatile unsigned int*)’ previously defined here
>    FORCEINLINE unsigned InterlockedIncrement (unsigned volatile *Addend) { return (unsigned) InterlockedIncrement ((volatile __LONG32 *) Addend); }
>                         ^
> /usr/include/w32api/winbase.h: In function ‘unsigned int _InterlockedDecrement(volatile unsigned int*)’:
> /usr/include/w32api/winbase.h:2930:33: error: redefinition of ‘unsigned int _InterlockedDecrement(volatile unsigned int*)’
>    FORCEINLINE unsigned __LONG32 InterlockedDecrement (unsigned __LONG32 volatile *Addend) { return (unsigned __LONG32) InterlockedDecrement ((volatile __LONG32 *) Addend); }
>                                  ^
> /usr/include/w32api/winbase.h:2929:24: error: ‘unsigned int _InterlockedDecrement(volatile unsigned int*)’ previously defined here
>    FORCEINLINE unsigned InterlockedDecrement (unsigned volatile *Addend) { return (unsigned __LONG32) InterlockedDecrement ((volatile __LONG32 *) Addend); }
>                         ^


So the declaration was:
> extern "C++" {
>   FORCEINLINE unsigned InterlockedIncrement (unsigned volatile *Addend) { return (unsigned) InterlockedIncrement ((volatile __LONG32 *) Addend); }
>   FORCEINLINE unsigned __LONG32 InterlockedIncrement (unsigned __LONG32 volatile *Addend) { return (unsigned __LONG32) InterlockedIncrement ((volatile __LONG32 *) Addend); }

Cygwin64 g++ wasn't happy with that. Cygwin 32bit mode is fine though.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 663 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20130926/7784f558/attachment.sig>


More information about the Cygwin mailing list