Linux中的蓝牙编程

Linux中的蓝牙编程

本文介绍了Linux中的蓝牙编程-交叉编译器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了

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 ?

谢谢

推荐答案

我猜您的交叉编译器带有完整的toolchainSDK.

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.

如果headerlib存在,则必须将#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中的蓝牙编程-交叉编译器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 20:52