我如何包括<蓝牙/ bluetooth.h>对于NDK工具链的GCC蓝牙、工具、bluetooth、LT

2023-09-06 06:30:46 作者:你已被我out

首先,我想,当编译交流计划,以Linux的ARM架构,以备后用它在一个Android应用程序有一个问题最后一次。我做得很成功,我会写后,一个关于如何使用NDK的独立工具链职位。

first of all, i got into a problem last time when trying to compile a c program to linux- arm architecture, for using it in an android app later. I succeeded in doing so, and i'll write later a post on how to use the NDK standalone toolchain.

现在,我终于得到了该工作,我尝试编译.c文件,其中有一条线包括蓝牙/ bluetooth.h。当我尝试编译文件,我收到了:没有这样的文件或目录的错误就可以了。我的makefile文件包含单词-libbluetooth。 该旗NDK GCC库一点儿也不有蓝牙的支持,所以我从我的设备,而这正是我需要的,使工作,根据对通过互联网这一主题的简要研究下载libbluetooth.so。我仍然得到同样的错误。

Now that i've finally got that working, I'm trying to compile a .c file, which has a line "include bluetooth/bluetooth.h" in it. When I try to compile the file, i get a: "no such file or directory" error on it. My makefile includes the word "-libbluetooth". The standart NDK gcc library does'nt have a bluetooth support, so i've downloaded "libbluetooth.so" from my device, which is what i needed to make it work, according to the brief research on the subject over the internet. I still get the same error.

我会很高兴知道是否有人遇到同样的问题。 感谢你 德克尔

I'll be glad to know if anyone has encountered the same problem. thank u Dekel

推荐答案

您需要蓝牙库链​​接程序;但编译它,你需要相应的头文件。 libbluetooth.so 是不是官方的Andr​​oid API的一部分,但幸运的是,你可以找到它的来源和对包括申报文件,其公开的(但非官方的)的API,如果你下载AOSP源代码树,根据谷歌的说明。其实,你有兴趣在树中的一小部分: ./外部/蓝牙/ bluez的/ lib目录。在那里,你会发现蓝牙/ bluetooth.h 包含文件。在你的 Android.mk ,你将有相似的一行:

You need the bluetooth library to link your program; but to compile it, you need the appropriate headers. libbluetooth.so is not part of Android official API, but luckily you can find it sources and the include files that declare its public (but unofficial) API, if you download the AOSP source tree, according to Google's instructions. Actually, you are interested in a small part of the tree: ./external/bluetooth/bluez/lib. There you will find the bluetooth/bluetooth.h include file. In your Android.mk, you will have a line similar to:

LOCAL_C_INCLUDES += $(AOSP_ROOT)/external/bluetooth/bluez/lib