给出未定义的引用

cmake give undefined reference

本文关键字:引用 未定义      更新时间:2023-10-16

你好,我试图使用bluez源代码来控制我的代码中的一些东西。

在我的cmake中,我首先开始执行像

这样的指令
include_directories(${CMAKE_SOURCE_DIR}/../bluez/attrib/)
然后

aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/attrib/ SRC_BLUEZ_ATTRIB_LIST)
最后将SRC_BLUEZ_ATTRIB_LIST加到add_executable

但是我还有

undefined reference to gatt_connect(char const*, char const*, char const*, char const*, int, int, void (*)(_GIOChannel*, _GError*, void*), _GError**)

任何建议吗?

c++源文件中使用extern "C"

extern "C" {
   #include "gatttool.h"
}