Multiple Definition compiler error

I am going through this excellent write-up on using the TensorFlowLite library.

I have created the in memory array file, however, when I include it, the compiler complains that the declaration of linear_regression_model_tflite is defined twice and the error references the same file showing the multiple definitiions. I have added #pragma once with no effect.

My file is in the src directory with my ino file.
Here is my ino code.


#include "tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/micro_interpreter.h"
#include "tensorflow/lite/schema/schema_generated.h"
#include "tensorflow/lite/version.h"

#include "linear_regression_model_data.h" // <- Generates the error

void setup() {  

void loop() {

The error I am getting is this (this repeats for the definition of the array as well)

Creating /xxx/TensorFlowLiteArgon/target/3.3.0/argon/platform_user_ram.ld ...
/xxx/.particle/toolchains/gcc-arm/10.2.1/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: ../../../build/target/user/platform-12-m/TensorFlowLiteArgon//libuser.a(linear_regression_model_data.o):/xxx/TensorFlowLiteArgon//src/linear_regression_model_data.cpp:91: multiple definition of `linear_regression_model_tflite_len'; ../../../build/target/user/platform-12-m/TensorFlowLiteArgon//libuser.a(TensorFlowLiteArgon.o):/xxx/TensorFlowLiteArgon//src/linear_regression_model_data.h:92: first defined here

I’m sure it is something completely stupid on my part but I cannot figure out how to fix this issue.

Error has miraculously gone away.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.