【问题标题】:Not able to link gcc against libbluetooth library无法将 gcc 与 libbluetooth 库链接
【发布时间】:2019-04-17 17:20:12
【问题描述】:

我正在使用 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】:

    “lib”是隐含的,所以链接到“bluetooth”而不是“libbluetooth”:

    $ gcc -o output myfile.c -lbluetooth
    

    【讨论】:

      猜你喜欢
      • 2016-01-18
      • 2021-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-22
      • 2019-01-31
      • 2012-06-07
      相关资源
      最近更新 更多