基於bluez or socketcan等 程序編譯時注意事項

基於bluez程序編譯時注意事項                                 

 

第一:不要用到哪個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'
  以上亦可用到socketcan中
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章