Я получаю несколько ошибок компиляции, если компилирую следующую функцию в Visual Studio 2005:
void search()
{
deviceEventHandle = CreateEvent(NULL, FALSE, FALSE, "foundDevice");
BTUINT32 deviceClass = 0; // 0 represents all classes
BTUINT16 maxDevices = 200; // 0 represents an unlimited number of responses
BTUINT16 maxDuration = 45; // maxDuration * 1.28 = number of seconds
Btsdk_StartDeviceDiscovery(deviceClass, maxDevices, maxDuration);
WaitForSingleObject(deviceEventHandle, INFINITE);
if (deviceEventHandle != NULL) {
CloseHandle(deviceEventHandle);
deviceEventHandle = NULL;
}
}
Вот ошибки, которые я получаю:
error C2275: 'BTUINT32' : illegal use of this type as an expression
error C2146: syntax error : missing ';' before identifier 'deviceClass'
error C2065: 'deviceClass' : undeclared identifier
error C2275: 'BTUINT16' : illegal use of this type as an expression
error C2146: syntax error : missing ';' before identifier 'maxDevices'
error C2065: 'maxDevices' : undeclared identifier
error C2275: 'BTUINT16' : illegal use of this type as an expression
error C2146: syntax error : missing ';' before identifier 'maxDuration'
error C2065: 'maxDuration' : undeclared identifier
Если я закомментирую строку, содержащую вызов CreateEvent, код компилируется без ошибок:
void search()
{
//deviceEventHandle = CreateEvent(NULL, FALSE, FALSE, "foundDevice");
BTUINT32 deviceClass = 0; // 0 represents all classes
BTUINT16 maxDevices = 200; // 0 represents an unlimited number of responses
BTUINT16 maxDuration = 45; // maxDuration * 1.28 = number of seconds
Btsdk_StartDeviceDiscovery(deviceClass, maxDevices, maxDuration);
WaitForSingleObject(deviceEventHandle, INFINITE);
if (deviceEventHandle != NULL) {
CloseHandle(deviceEventHandle);
deviceEventHandle = NULL;
}
}
Вот заголовки, которые я использую:
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#include "Btsdk_ui.h"
Я компилирую код как код C (/ TC) в Visual Studio 2005. Файл "Btsdk_ui.h" является частью стека Bluetooth BlueSoleil и включает в себя другой файл, который содержит определения BTUINT32 и BTUINT16.
Все предложения приветствуются.