无法将gcc链接到libbluetooth库

问题描述 投票:0回答:1

我正在使用BlueZ库来使用C开发基于蓝牙的Linux应用程序。我试图将libbluetooth-dev链接到我的C文件,但它无法正常工作。

/usr/bin/ld: cannot find -libbluetooth-dev
collect2: error: ld returned 1 exit status

我的项目目录是bluez-5.45,我试图从这个文件夹构建项目并在我的主文件夹中添加我的.C文件

我安装了libbluetooth-dev库并尝试了链接但不能这样做。链接命令:gcc -o output myfile.c -libbluetooth

请让我知道我做的错误。

c linux bluetooth bluez
1个回答
0
投票

暗示“lib”,因此链接“bluetooth”而不是“libbluetooth”:

$ gcc -o output myfile.c -lbluetooth
© www.soinside.com 2019 - 2024. All rights reserved.