People in the thread have been trying to discuss some facts and help with education.
Here is some further education.
The <bluetooth/bluetooth.h> includes, and the corresponding library link, libbluetooth.so, for Linux Bluetooth development are part of the Ubuntu libbluetooth-dev package.
A very simple example program is (basic C code from here):
#include <QCoreApplication>
#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>
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
inquiry_info *ii = NULL;
int max_rsp, num_rsp;
int dev_id, sock, len, flags;
int i;
char addr[19] = { 0 };
char name[248] = { 0 };
dev_id = hci_get_route(NULL);
sock = hci_open_dev( dev_id );
if (dev_id < 0 || sock < 0) {
perror("opening socket");
exit(1);
}
len = 8;
max_rsp = 255;
flags = IREQ_CACHE_FLUSH;
ii = (inquiry_info*)malloc(max_rsp * sizeof(inquiry_info));
num_rsp = hci_inquiry(dev_id, len, max_rsp, NULL, &ii, flags);
if( num_rsp < 0 ) perror("hci_inquiry");
for (i = 0; i < num_rsp; i++) {
ba2str(&(ii+i)->bdaddr, addr);
memset(name, 0, sizeof(name));
if (hci_read_remote_name(sock, &(ii+i)->bdaddr, sizeof(name),
name, 0) < 0)
strcpy(name, "[unknown]");
printf("%s %s\n", addr, name);
}
free( ii );
close( sock );
return 0;
}
and a minimal Qt project file (test.pro) that will compile and link it:
TEMPLATE = app
TARGET = test
INCLUDEPATH += .
SOURCES += main.cpp
LIBS += -lbluetooth
The libbluetooth-dev package puts everything in standard paths so:
No need to add search locations to INCLUDEPATH so the compiler can find the header files
No need to add search locations to LIBS with -L options
The only thing required to link is the name of a library to connect with the application, in this case the bluetooth library identified in the LIBS variable -lbluetooth.
For libraries in Linux there is often a pkg-config file that can be queried (it is confusingly named in this case):
# Things you may need to add the INCLUDEPATH or CFLAGS (for the compiler)
$ pkg-config --cflags bluez
# Things you need to consider for LIBS (for the linker)
$ pkg-config --libs bluez
-lbluetooth
You can even ask Qt to use pkg-config directly to set INCLUDEPATH and LIBS internally:
TEMPLATE = app
TARGET = test
INCLUDEPATH += .
SOURCES += main.cpp
CONFIG += link_pkgconfig
PKGCONFIG += bluez