I’m struggling searching the correct way to develop a library.
I already followed instructions by ( Creating Library — PlatformIO latest documentation ) with no luck.
I using vscode with platformio plugin and would of help if Projects/Create New Project wizard allow to choose between Application or RegistryLibrary to allow developer start with a correct library structure.
More could helpful if platformio examples repo contains a dedicated registry-lib folder with a bare skeleton to develop a library with src, include, examples, unit test the right way.
Btw I already published one and I succesfully use into another application but I have to remove the library.json file from the local libdeps or the compiler will generate error and I would to know why this happens.
REPRO
- from vscode, platformio create new project ( name: test1, board: nucleo f446re, framework: arduino )
- from pio terminal :
pio lib install "devel0/iot-utils@0.7.0"
- setup
src/main.cpp
as follow
#include <Arduino.h>
#include <string-utils.h>
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
- from pio start a build
- follows errors
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_f446re.html
PLATFORM: ST STM32 (12.1.1) > ST Nucleo F446RE
HARDWARE: STM32F446RET6 180MHz, 128KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, cmsis-dap, jlink)
PACKAGES:
- framework-arduinoststm32 4.10900.200819 (1.9.0)
- framework-cmsis 2.50501.200527 (5.5.1)
- toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 10 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/nucleo_f446re/src/main.cpp.o
src/main.cpp:3:10: fatal error: string-utils.h: No such file or directory
to solve I have to remove or rename the .pio/libdeps/nucleo_f446re/iot-utils/library.json
but I don’t know why ( here library.json
relates to library itself ) ; after removed file dependency scanner correctly find the library and error disappears:
Found 11 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <iot-utils> 0.7.0
Building in release mode