简体   繁体   English

我如何在ubuntu上安装bluez进行开发?

[英]how do i install bluez on ubuntu for development?

Beginner Question: 初学者问题:

I'd like to use the BlueZ driver in my Raspberry Pi for a simple way to connect to an iPhone app I'm writing, but I'm trying to prototype it first on my Ubuntu boot (I dual boot a macbook pro w/ macOS sierra/Ubuntu 16.04). 我想在我的Raspberry Pi中使用BlueZ驱动程序以一种简单的方式连接到我正在编写的iPhone应用程序,但我正在尝试在我的Ubuntu启动时首先对其进行原型设计(我是双启动一个macbook pro w / macOS sierra / Ubuntu 16.04)。 I am having trouble getting the bluetooth header "bluetooth.h" to show up in my c program. 我无法将蓝牙标题“bluetooth.h”显示在我的c程序中。 I've tried doing sudo apt-get install bluez, but no bluetooth.h header shows up in my system after I perform this command. 我尝试过sudo apt-get install bluez,但执行此命令后,我的系统中没有出现bluetooth.h标头。 Here are the includes for my prototype application: 以下是我的原型应用程序的包含:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>

when I gcc the program, I link to -lbluetooth , but my system can't find that lib either. 当我gcc程序时,我链接到-lbluetooth ,但我的系统也找不到该lib。

I should be using BlueZ for this, right? 我应该使用BlueZ,对吧? I've read that BlueZ is the official bluetooth stack for Linux, and I plan to put Raspbian Jesse on my raspberry pi; 我已经读过BlueZ是Linux的官方蓝牙堆栈,我打算把Raspbian Jesse放在我的覆盆子pi上; I'm just sanity checking that I'm on the right path. 我只是在理智地检查我是在正确的道路上。

http://docs.cubieboard.org/tutorials/common/development/bluez_programming http://docs.cubieboard.org/tutorials/common/development/bluez_programming

Looks like this tutorial had the answers, sudo apt-get install bluez installed the driver, but not the related development headers. 看起来这个教程有答案, sudo apt-get install bluez安装了驱动程序,但没有相关的开发头文件。 Instead use sudo apt-get install bluez libbluetooth-dev . 而是使用sudo apt-get install bluez libbluetooth-dev Now -lbluetooth is found as a lib. 现在-lbluetooth被发现是一个lib。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM