Search code examples
c++bluetoothheader-filesdev-c++

Why do I receive syntax error when including BluetoothAPIs.h from Microsoft SDK?


When I try to include BluetoothAPIs.h, the compiler shows me multiple syntax errors, e. g.:

[C++ Error] BluetoothAPIs.h(133): E2141 Declaration syntax error
[C++ Error] BluetoothAPIs.h(171): E2238 Multiple declaration for '__checkReturn'
...

This is BluetoothAPIs.h "invalid" part of code:

Lines 132-138:

__checkReturn
HBLUETOOTH_RADIO_FIND
WINAPI
BluetoothFindFirstRadio(
    __in const BLUETOOTH_FIND_RADIO_PARAMS * pbtfrp,
    __out HANDLE *                      phRadio
    );

Lines 170-176:

__checkReturn
BOOL
WINAPI
BluetoothFindNextRadio(
    __in  HBLUETOOTH_RADIO_FIND hFind,
    __out HANDLE * phRadio
    );

The .h file I took from Microsoft SDK.

UPD 2021:

I never realised what really caused the error, but seems that using Visual Studio instead of Dev-C++ solves the problem. Now I'm wondering what should I change in order to get it to work in Dev-C++?


Solution

  • When you say "The .h file I taked from Microsoft SDK.", do you mean: a) SDK is installed on my machine and accessible in my IDE? b) I picked up this file only?

    If b) then you're missing a lot of files...

    the first occurence of the macro __checkReturn is at line 132 of BluetoothAPIs.h, the one you mention...