This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: winbase.h issue


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.


Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]