I am trying to run a basic code of c in linux[ubuntu] to search bluetooth device, but i am facing some problem.
By using command sudo apt-get install bluez
, to install required blueZ library it is saying that bluez is already newest version.
But error comes that not able to find bluetooth.h
and other files in compiling C source code, with gcc -o simplescan simplescan.c -lbluetooth
Is there a complete library package, or do I have to download these header files?.
I am following this link
While Bluetooth hardware has advanced, there has been no standardized way to develop Bluetooth applications - until JSR 82 came into play. It is the first open, non-proprietary standard for developing Bluetooth applications using the Java programming language.
Open the Activities overview and start typing Bluetooth. Click on Bluetooth to open the panel. Make sure Bluetooth is enabled: the switch at the top should be set to on. With the panel open and the switch on, your computer will begin searching for devices.
Install BlueZ on Linux Install BlueZ packages by using any of the following commands that matches your Linux distribution. This installation provides the bluetoothctl utility. You need to add your account to the lp group if you wish to connect to a bluetooth tether. The bluetooth device should be started and enabled.
This solved my problem:
apt-get install libbluetooth-dev
As for i know there no packages for these headers. You have to download the following header files from internet.
bluetooth.h
hci.h
hci_lib.h
and create a directory called "bluetooth
" under /usr/lib/
in your host machine and copy the above headers to /usr/lib/bluetooth/
. Then compile your program, it should work.
Note: while compiling link with -lbluetooth
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With