Hello,
I’m writing a library to use openGoPro API on a ESP32 following the folder structure described in
https://docs.platformio.org/en/latest/librarymanager/creating.html: Sources (.cpp and .h) for the library is in src folder and examples are in examples folder like below.
|--include
| |--GoProBLE.h
|-src
| |--GoProBLE.cpp
|--examples
| |--M5Stack
| |--main.cpp
|--libary.json
|--platformio.ini
I tried to setup my file platformio.ini like explained here: https://community.platformio.org/t/configure-platformio-ini-of-library-so-that-examples-can-be-compiled/24046 but I cannot link the example, I have always a link error. I tried to change lib_extra_dirs but I cannot make it work.
PlatformIO\Projects\OpenGoProBLE/examples/M5Stack/main.cpp:53: undefined reference to `GoProBLE::GoProBLE()’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\ExM5Stack\firmware.elf] Error 1
my platformio.ini file is
[env]
platform = espressif32
framework = arduino
board = m5stack-core-esp32
monitor_speed=115200
[platformio]
src_dir = examples
lib_dir = ./
[env:ExM5Stack]
lib_extra_dirs =../../
lib_deps =
m5stack/M5Stack @ ^0.4.6
h2zero/NimBLE-Arduino@^1.4.1
src_filter = -<*> +<M5Stack/main.cpp>
If anyone knows how to fix it, maybe it’s easy as most libraries follow this pattern