问题描述
我已经安装了
sudo apt-get install libbluetooth-dev
在我的环境中安装蓝牙程序包.
to have bluetooth package in my environment.
因此,使用以下命令可以使用gcc成功编译蓝牙代码.
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
我遇到了致命错误:
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 ?
谢谢
推荐答案
我猜您的交叉编译器带有完整的toolchain
和SDK
.
I guess your cross compiler comes with a complete toolchain
and SDK
.
您必须检查例如libBluetooth.so
安装在SDK中的/usr/lib
或/usr/local/lib
文件夹下,并且SDK
中包含正确的标头(为i386/x64
平台安装的标头).
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
.
如果header
和lib
存在,则必须将#include
更改为代码,以匹配SDK
的路径.
In case of the header
and lib
exist you must change your #include
into your code to match the path into your SDK
.
这篇关于Linux中的蓝牙编程-交叉编译器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!