Hello ,
I am trying to work with platformIO but this anoying feature or bug of LDF is killing me.
the LDF doesnt parse subdirectories more than 1 deep and so I cant organize my work so it is a mess.
the directory is like this
lib
-----hal
----------drivers
-------------button.cpp
-------------button.h
------hal.cpp
------hal.h
-----system
-------system.cpp
-------system.h
…
main is calling system,system is calling hal and
hal is calling button
understable?LDF
Having hal.cpp and hal.h in the lib/ folder directly as shown above is incorrect in any way. Each library must be in its own folder in lib/.
And if you have a hal library with drivers/button.h, you can include "drivers/button.h" just fine. If you want button.h to be incidable as #include "button.h", then add a library.json that adds all sub-include paths per documentation.
ok i worked on this now and the “drivers/button.h” is quite working but another error poped up
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\libc0e\lib1.)HAL(Hal.cpp.o):(.literal._ZN3HalC2Ev+0x0): undefined reference to `Button::Button()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\libc0e\lib1.)HAL(Hal.cpp.o):(.literal._ZN3HalC2Ev+0x4): undefined reference to `Display::Display()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\libc0e\lib1.)HAL(Hal.cpp.o):(.literal._ZN3HalC2Ev+0x8): undefined reference to `Button::~Button()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\libc0e\lib1.)HAL(Hal.cpp.o):(.literal._ZN3HalD2Ev+0x0): undefined reference to `Display::~Display()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\libc0e\lib1.)HAL(Hal.cpp.o): in function `Hal::Hal()':
C:\Users\micha\Desktop\MATOS\MATY OS/lib/1.)HAL/hal.cpp:15: undefined reference to `Button::Button()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\micha\Desktop\MATOS\MATY OS/lib/1.)HAL/hal.cpp:15: undefined reference to `Display::Display()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\micha\Desktop\MATOS\MATY OS/lib/1.)HAL/hal.cpp:15: undefined reference to `Button::~Button()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\libc0e\lib1.)HAL(Hal.cpp.o): in function `Hal::~Hal()':
C:\Users\micha\Desktop\MATOS\MATY OS/lib/1.)HAL/hal.cpp:16: undefined reference to `Display::~Display()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\micha\Desktop\MATOS\MATY OS/lib/1.)HAL/hal.cpp:16: undefined reference to `Button::~Button()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\src\main.cpp.o:(.literal._Z4loopv+0x4): undefined reference to `Button::inicializace(int)'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\src\main.cpp.o: in function `loop()':
C:\Users\micha\Desktop\MATOS\MATY OS/src/main.cpp:102: undefined reference to `Button::inicializace(int)'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\lib187\lib3.)GUI-GRAPHICS(Graphics.cpp.o):(.literal._ZN8GraphicsC2Ev+0x0): undefined reference to `Gui::Gui()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\lib187\lib3.)GUI-GRAPHICS(Graphics.cpp.o):(.literal._ZN8GraphicsD2Ev+0x0): undefined reference to `Gui::~Gui()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\lib187\lib3.)GUI-GRAPHICS(Graphics.cpp.o): in function `Graphics::Graphics()':
C:\Users\micha\Desktop\MATOS\MATY OS/lib/3.)GUI-GRAPHICS/graphics.cpp:9: undefined reference to `Gui::Gui()'
c:/users/micha/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32s3camlcd\lib187\lib3.)GUI-GRAPHICS(Graphics.cpp.o): in function `Graphics::~Graphics()':
C:\Users\micha\Desktop\MATOS\MATY OS/lib/3.)GUI-GRAPHICS/graphics.cpp:13: undefined reference to `Gui::~Gui()'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32s3camlcd\firmware.elf] Error 1
It can’t find the implementation for all these constructors, destructors and other functions. Without seeing the full project, it’s impossible to tell what’s wrong exactly.