Bluetooth programming in Linux - cross compiler issue

依然范特西╮ 提交于 2020-01-14 04:18:26

问题


I've installed

sudo apt-get install libbluetooth-dev

to have bluetooth package in my environment.

Hence, using the following command can successfully compile the bluetooth code using gcc.

gcc -o bt bt.c -lbluetooth

However, when I tried to use the cross-compiler to compile the source code

$CC -o bt2 bt.c -lbluetooth

I got the fatal error:

fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated

Is there anything I've done wrong or I need to link this library to this cross-compiler ?

Thanks


回答1:


I guess your cross compiler comes with a complete toolchain and SDK.

You must check that e.g. libBluetooth.so installed into your SDK under /usr/lib or /usr/local/lib folders and the correct header, as the one installed for i386/x64 platform, is present into SDK.

In case of the header and lib exist you must change your #include into your code to match the path into your SDK.



来源:https://stackoverflow.com/questions/36736362/bluetooth-programming-in-linux-cross-compiler-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!