Undefined references to tflite functions

I am trying to upload a very simple TensorFlow Lite for Microcontrollers code to my Nicla Sense ME device. But for some reason the linker is unable to find the definitions for the referenced symbols from the TensorFlow Lite library. Here are some errors I get:

main.cpp:(.text._Z23ProfileMemoryAndLatencyv+0x6e): undefined reference to `tflite::MicroInterpreter::AllocateTensors()'
main.cpp:(.text._Z23ProfileMemoryAndLatencyv+0xbe): undefined reference to `tflite::MicroInterpreter::input(unsigned int)'
main.cpp:(.text._Z23ProfileMemoryAndLatencyv+0xcc): undefined reference to `tflite::MicroInterpreter::Invoke()'
main.cpp:(.text._Z23ProfileMemoryAndLatencyv+0xd8): undefined reference to `tflite::MicroProfiler::LogTicksPerTagCsv()'
main.cpp:(.text._Z23ProfileMemoryAndLatencyv+0xde): undefined reference to `tflite::RecordingMicroAllocator::PrintAllocations() const'
main.cpp:(.text._Z23ProfileMemoryAndLatencyv+0xe4): undefined reference to `tflite::MicroInterpreter::~MicroInterpreter()'
main.cpp:(.text._Z23ProfileMemoryAndLatencyv+0xf8): undefined reference to `vtable for tflite::MicroProfiler'

How should I debug this further?

How did you setup the project? What platformio.ini are you using? Did you manually copy TFLite / Micro sources from their repo or reference it with lib_deps?

Hi @maxgerhardt,

Here is my platform.ini:

platform = nordicnrf52
board = nicla_sense_me
framework = arduino

I have added them in the include folder

Where are the source files (.cpp, .c)? All in include/? Files in include/ are not compiled. Restructure it to a new folder in lib/.

1 Like

@maxgerhardt yes, they are all there except the main.cpp. Alright, I will restructure and update here. Many thanks.

Hi @maxgerhardt, putting them to lib fixed my issue. Many thanks.