在网上下载的蓝牙传输代码,编译出错不知道如何解决求助

puj2003 2015-01-04 01:55:18
BlueTooth.h:
// for WSALookupServiceBegin() WSALookupServiceNext etc.
#include <winsock2.h>
#pragma comment(lib,"ws2_32.lib")
#include <ws2bth.h>

// for BluetoothFindFirstDevice() BluetoothFindNextDevice() etc.
#include <bthsdpdef.h>
#include <BluetoothAPIs.h>
#pragma comment ( lib, "Irprops.lib")

// 远程蓝牙设备详细信息
typedef struct _RemoteBthDevInfo
{
_RemoteBthDevInfo ()
{
hRadio = NULL;
memset ( szName, 0, sizeof(szName) );
memset ( &Address, 0, sizeof(BLUETOOTH_ADDRESS) );
memset ( guidServices, 0, sizeof(guidServices) );
hRegHandle = NULL;
pAUTHENTICATION_CALLBACK_Para = NULL;
}
HANDLE hRadio;
TCHAR szName[64];
BLUETOOTH_ADDRESS Address; 这一行报错,错误信息见下,BLUETOOTH_ADDRESS 明明已经在BluetoothAPIs.h 里面申明过了
GUID guidServices[10];
HBLUETOOTH_AUTHENTICATION_REGISTRATION hRegHandle;
t_AUTHENTICATION_CALLBACK_Para *pAUTHENTICATION_CALLBACK_Para;
} t_RemoteBthDevInfo;
错误信息:
1>d:\360安全浏览器下载\bluetoothtransfer\bluetooth.h(49): error C2146: 语法错误: 缺少“;”(在标识符“Address”的前面)
1>d:\360安全浏览器下载\bluetoothtransfer\bluetooth.h(49): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\360安全浏览器下载\bluetoothtransfer\bluetooth.h(49): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\360安全浏览器下载\bluetoothtransfer\bluetooth.h(51): error C2146: 语法错误: 缺少“;”(在标识符“hRegHandle”的前面)
1>d:\360安全浏览器下载\bluetoothtransfer\bluetooth.h(51): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\360安全浏览器下载\bluetoothtransfer\bluetooth.h(51): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>d:\360安全浏览器下载\bluetoothtransfer\bluetooth.h(42): error C2065: “Address”: 未声明的标识符
1>d:\360安全浏览器下载\bluetoothtransfer\bluetooth.h(42): error C2065: “BLUETOOTH_ADDRESS”: 未声明的标识符
...全文
330 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xsophiax 2015-02-27
  • 打赏
  • 举报
回复
重新定义:#define NTDDI_VERSION 0x06010000 即可
tangtangtangbaoli 2015-01-09
  • 打赏
  • 举报
回复
看看BluetoothAPIs.h 里面定义BLUETOOTH_ADDRESS类型的地方,有没有条件编译宏,给这个定义给else掉了
puj2003 2015-01-06
  • 打赏
  • 举报
回复
在代码里面怎么判断蓝牙是否连接了呢?
puj2003 2015-01-05
  • 打赏
  • 举报
回复
引用 3 楼 wutaozhao 的回复:
#include <BluetoothAPIs.h> 你蓝牙头文件和库的路径,在IDE里设置过了?编译提示错误应该是没找到头文件导致
BluetoothAPIs.h路径为:C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include Irprops.lib路径为:C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib 我在vs工程属性——配置属性——VC++目录中可执行文件目录,包含目录和库目录分别加上上面的路径,但还是报错,费解啊
小麻侬 2015-01-05
  • 打赏
  • 举报
回复
#include <BluetoothAPIs.h> 你蓝牙头文件和库的路径,在IDE里设置过了?编译提示错误应该是没找到头文件导致
puj2003 2015-01-05
  • 打赏
  • 举报
回复
引用 1 楼 allenemo 的回复:
建议使用CxBthRadio & CxBthRadioFind http://www.cnblogs.com/EdmundDwyane/p/3292454.html CxBthClientSocket http://www.cnblogs.com/EdmundDwyane/p/3161524.html
、 你这个后面在研究,但是谁能先帮我解决编译哇
阿先森 2015-01-04
  • 打赏
  • 举报
回复

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧