基于bluez程序编译时注意事项
2009-10-26 12:32
399 查看
制作了一个基于bluez的,类似于BTW的库---BTX.在编写和使用这个库时,发现头文件包含容易出现的问题。
第一:不要用到哪个Bluez头文件中定义的内容就只去包含这个头文件。而应该将bluetooth/bluetooth.h最先加入。类似:
//==================================
//bluetooth header file
#include <bluetooth/bluetooth.h> //BTPROTO_HCI
#include <bluetooth/hci.h> //struct hci_dev_info
#include <bluetooth/hci_lib.h> //hci_devid()
#include <bluetooth/l2cap.h> //l2cap
#include <bluetooth/hidp.h> //hidp
第二:因为Linux 下Bluetooth实现是通过socket来完成的。sa_family_t会被使用。
bluetooth/hci.h中就用到了。所以必须在include bluetooth header file之前,include socket header file.
#include <sys/types.h>
#include <sys/socket.h>
否则就会出现类似以下问题:
bluetooth/hci.h:1091: error: expected specifier-qualifier-list before 'sa_family_t'
第一:不要用到哪个Bluez头文件中定义的内容就只去包含这个头文件。而应该将bluetooth/bluetooth.h最先加入。类似:
//==================================
//bluetooth header file
#include <bluetooth/bluetooth.h> //BTPROTO_HCI
#include <bluetooth/hci.h> //struct hci_dev_info
#include <bluetooth/hci_lib.h> //hci_devid()
#include <bluetooth/l2cap.h> //l2cap
#include <bluetooth/hidp.h> //hidp
第二:因为Linux 下Bluetooth实现是通过socket来完成的。sa_family_t会被使用。
bluetooth/hci.h中就用到了。所以必须在include bluetooth header file之前,include socket header file.
#include <sys/types.h>
#include <sys/socket.h>
否则就会出现类似以下问题:
bluetooth/hci.h:1091: error: expected specifier-qualifier-list before 'sa_family_t'
相关文章推荐
- 基于bluez程序编译时注意事项
- 基于bluez程序编译时注意事项
- 使用C/C++语言编写基于DSP程序的注意事项
- 使用静态库时需要注意的事项(gcc下程序调用静态库编译命令:主文件必须在静态库前面!)
- 使用静态库时需要注意的事项(gcc下程序调用静态库编译命令:主文件必须在静态库前面!)
- 基于vs2005以上版本Qt程序发布的注意事项
- 基于Qt 4.6的Qt Creator 1.3.0写helloworld程序注意事项
- win7上编译的用ADO访问Access数据库的程序运行在WindowsServer2003上的注意事项
- 编写Windows Mobile上基于WTL封装的CHTMLCtrl程序注意事项(备忘)
- OpenCV程序交叉编译注意事项
- 基于bluez or socketcan等 程序编译时注意事项
- 程序单独编译注意事项
- 程序编译时书写Makefile注意事项一例
- Linux编译程序时的一些注意事项
- 1.4.Qt通过命令行编译运行程序注意事项
- 编写Windows Mobile上基于WTL封装的CHTMLCtrl程序注意事项(备忘)
- Linux编译程序时的一些注意事项
- 编写基于DSP程序的注意事项
- 编译用到MySQL API的程序的一项注意事项
- 几个DSP高手的经验介绍,编写基于DSP程序的注意事项