user1796260
user1796260

Reputation: 297

cmake give undefined reference

Hi I'm trying to use bluez source code to control some stuff in my code.

In my cmake I first start doing instruction like

include_directories(${CMAKE_SOURCE_DIR}/../bluez/attrib/)

then

aux_source_directory(${CMAKE_SOURCE_DIR}/../bluez/attrib/ SRC_BLUEZ_ATTRIB_LIST)

and finaly add SRC_BLUEZ_ATTRIB_LIST to my add_executable

But I still have

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

Any suggestion?

Upvotes: 0

Views: 258

Answers (1)

Peter Petrik
Peter Petrik

Reputation: 10185

Use extern "C" in your c++ source file

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

Upvotes: 1

Related Questions