简体   繁体   中英

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). I am having trouble getting the bluetooth header "bluetooth.h" to show up in my c program. I've tried doing sudo apt-get install bluez, but no bluetooth.h header shows up in my system after I perform this command. 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.

I should be using BlueZ for this, right? I've read that BlueZ is the official bluetooth stack for Linux, and I plan to put Raspbian Jesse on my raspberry pi; I'm just sanity checking that I'm on the right path.

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. Instead use sudo apt-get install bluez libbluetooth-dev . Now -lbluetooth is found as a lib.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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