Compiling code that uses the gcc -ansi flag no longer works with libbluetooth-dev, as the public API now makes use of typeof() which is a GNU extension and disabled by the -ansi flag.
$ cat main.c
#include <bluetooth/bluetooth.h>
int main() { return 0; }
$ gcc main.c -o main -ansi
In file included from main.c:1:0:
/usr/include/bluetooth/bluetooth.h:131:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:131:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_le64’
/usr/include/bluetooth/bluetooth.h:136:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:136:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_be64’
/usr/include/bluetooth/bluetooth.h:141:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:141:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_le32’
/usr/include/bluetooth/bluetooth.h:146:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:146:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_be32’
/usr/include/bluetooth/bluetooth.h:151:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:151:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_le16’
/usr/include/bluetooth/bluetooth.h:156:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:156:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘bt_get_be16’
/usr/include/bluetooth/bluetooth.h:204:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
/usr/include/bluetooth/bluetooth.h:208:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
/usr/include/bluetooth/bluetooth.h:255:1: error: unknown type name ‘inline’
/usr/include/bluetooth/bluetooth.h:255:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ntoh64’
/usr/include/bluetooth/bluetooth.h:266:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
/usr/include/bluetooth/bluetooth.h:274:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
$ apt-cache policy libbluetooth-dev
libbluetooth-dev:
Installed: 4.98-2ubuntu4
Candidate: 4.98-2ubuntu4
Version table:
*** 4.98-2ubuntu4 0
500 http://de.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
100 /var/lib/dpkg/status
$ lsb_release -rd
Description: Ubuntu precise (development branch)
Release: 12.04
This is an issue that should be worked on upstream. As far as I know, there was a "conscious" decision to use typeof there to support different other uses of compiling against bluetooth.h, especially for C++ applications.
Please see http:// www.bluez. org/contact/ for how to report this bug upstream, then comment here with a link to the discussion if possible.
Thanks in advance!