Linux 中的蓝牙编程 - 交叉编译器问题
Bluetooth programming in Linux - cross compiler issue
我已经安装了
sudo apt-get install libbluetooth-dev
在我的环境中安装蓝牙包。
因此,使用下面的命令可以成功使用gcc编译蓝牙代码。
gcc -o bt bt.c -lbluetooth
但是,当我尝试使用交叉编译器编译源代码时
$CC -o bt2 bt.c -lbluetooth
我遇到了致命错误:
fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated
有没有我做错了什么或者我需要link这个库到这个交叉编译器?
谢谢
我猜你的交叉编译器带有完整的 toolchain
和 SDK
。
您必须检查,例如libBluetooth.so
安装到 /usr/lib
或 /usr/local/lib
文件夹下的 SDK 中,正确的 header 作为为 i386/x64
平台安装的那个,存在于 SDK
.
如果 header
和 lib
存在,您必须将 #include
更改为您的代码以匹配 SDK
.
中的路径
我已经安装了
sudo apt-get install libbluetooth-dev
在我的环境中安装蓝牙包。
因此,使用下面的命令可以成功使用gcc编译蓝牙代码。
gcc -o bt bt.c -lbluetooth
但是,当我尝试使用交叉编译器编译源代码时
$CC -o bt2 bt.c -lbluetooth
我遇到了致命错误:
fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated
有没有我做错了什么或者我需要link这个库到这个交叉编译器?
谢谢
我猜你的交叉编译器带有完整的 toolchain
和 SDK
。
您必须检查,例如libBluetooth.so
安装到 /usr/lib
或 /usr/local/lib
文件夹下的 SDK 中,正确的 header 作为为 i386/x64
平台安装的那个,存在于 SDK
.
如果 header
和 lib
存在,您必须将 #include
更改为您的代码以匹配 SDK
.