问题
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