ESP32 T-BEAM static (precompiled) library in arduino-cli

Hi there!

I am attempting to build a sketch using a static library .a.
I followed this post: Arduino Tutorials - How to Use Static (Pre-compiled) Libraries in Arduino - Seeed Wiki but I got an error during compilation:

Library PrebuiltLib has been declared precompiled:
Using precompiled library in /home/oscar/Arduino/libraries/PrebuiltLib/src/esp32
/tmp/arduino-sketch-9595712C3FF3F4D274F59DD186AB57D9/sketch/src/sensors/SensorA.cpp.o:(.literal._ZN11SensorA3runEb+0x18): undefined reference to `suma'
/tmp/arduino-sketch-9595712C3FF3F4D274F59DD186AB57D9/sketch/src/sensors/SensorA.cpp.o: In function `SensorA::run(bool)':
/home/oscar/App/src/sensors/Sensor.hpp:31: undefined reference to `suma'
collect2: error: ld returned 1 exit status

Error during build: exit status 1

My static library is called PrebuiltLib and has been built for the esp32:esp32:t-beam board. Its source code is:

  • PrebuiltLib.h
#ifndef PrebuiltLib_H
#define PrebuiltLib_H

#ifdef __cplusplus
extern "C" {
#endif

int suma (int a, int b);

#ifdef __cplusplus
}
#endif

#endif // PrebuiltLib_H
  • PrebuiltLib.c
#include "PrebuiltLib.h"

int suma (int a, int b) {
	return a +  b;
}

My arduino-cli version is 0.18.3 commit: d710b642.
Before removing the PrebuiltLib.c file, sketch is compiled successfully. When it is removed the error appears.

Oscar