bluetooth - Linking with libbluetooth.so -


At Ubuntu 14.04, I'm trying to make a small case of Bluetooth device entry but I face a simple problem Comparing this minimalistic demo when connecting with the Bluetooth Shared Library:

$ sudo apt-get install libbluetooth- dev $ gcc -lbluetooth simplescan.c -o simplescan /tmp/ccuwRsB5.o : 'Main' at the ceremony: Simplescan.c: (text + 0x79): 'undefined reference to hci_get_route' ..: `hci_open_dev 'simplescan.c :( undefined reference text + 0x132): simplescan.c: (text + 0x8c) undefined'. Text simplescan.c :( + 0x18f): references to `ba2str undefined reference 'hci_inquiry simplescan.c :( text + 0x1f0):. Undefined reference to `hci_read_remote_name 'collect2: error: exit to ld 1 position $ nm -d /usr/lib/x86_64-linux-gnu/libbluetooth.so.3.13.0 | Grapes hci_get_route 0000000000008f00 t hci_get_route

The Bluetooth shared library is found and is being done with essential functions, but adding does not achieve the phase.

The solution (for me) is astonishing: the sequence of arguments given to GCC is important. "-blblutooth" should be named after "simplescan.c":

  $ gcc simplescan.c -lbluetooth -o simplescan # success $ gcc -lbluetooth simplescan.c -o simplescan # failure / Tmp /ccWhZFXs.o: function `mainly ':. Simplescan.c: (text + 0x79): 'undefined reference to hci_get_route'. Simplescan.c: (text + 0x8c): `hci_open_dev '' '' 'undefined reference to simplescan.c :( .text + 0x132):' undefined reference to hci_inquiry '. Simplescan.c :( text + 0x18f): `undefined reference to ba2str 'simplescan.c :( text + 0x1f0):. Undefined context: error: Ld 1 exit status  
has returned `hci_read_remote_name 'collect2

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -