[libhid-discuss] unable to include hid.h in C++

Donald Kayser linux at kayser.net
Fri Oct 29 13:01:16 UTC 2010


Thanks for the suggestion of HIDAPI, but it does not claim to be  
usable in Linux/g++ world. Also, from what I have been able to find,  
<stdbool.h> does exactly the same kludge with bool, so it won't work.  
I suppose I will get the source and build my own version and delete  
the offending code. Sure would be nice if it worked as claimed.

Donald

On Oct 25, 2010, at 6:32 PM, Charles Lepple wrote:

> On Oct 25, 2010, at 6:21 PM, Donald Kayser wrote:
>
>> I am unable to use libhid with a c++ application since hid.h  
>> redefines bool.
>>
>> On lines around line 20 there is a macro
>> #define bool _Bool
>> #define true  1
>> #define false 0
>>
>> It is not legal to redefine reserved words.
>
> This kludge only comes into play if you do not have stdbool.h.
>
>> Has anyone else attempted to use libhid in a C++ application, and  
>> if so, what did you do to get around this?
>
> I think someone posted their source code to the list for getting  
> libhid to compile under Visual Studio - maybe that will help.
>
> A lot of people have had success recently with HIDAPI, so you might  
> want to look into that instead of libhid:
>
> http://www.signal11.us/oss/hidapi/
>
> It wraps a bunch of things in "#ifdef __cplusplus" so there's a  
> chance that someone is using it with C++.
>




More information about the libhid-discuss mailing list