Hello,
I have many questions and issues with the way files are included in platform io. First is that I get linker errors for undefined references even though the definitions are in a .cpp in the same folder as the header containing the declaration.
test_main.cpp:(.text._Z9test_loopv+0x13c): undefined reference to `LoRa_Module::ID_OF_THIS_CARD’
Lora_Module.h:
class LoRa_Module
{
static const uint16_t ID_OF_THIS_CARD;
};
LoRa_Module.cpp:
const uint16_t LoRa_Module::ID_OF_THIS_CARD = CARD_ID;
This ended up being the fix:
lib_extra_dirs =
lib/core/LoRa
in the platformio.ini. lib/core/LoRa is the folder in which the files are contained. I would like to understand why this is necessary.
Then next issue is that a header can’t be found fatal error: soft_uart.h: No such file or directory, even though it was found in projects with the very same architecture, and has the following path: lib/soft_uart/soft_uart.h
I tried to do what worked with the undefined references and add
lib_extra_dirs =
lib/soft_uart
to platformio.ini but it still cant find it. And again this works perfectly fine for other projects…
I have had many, many such issues, and am wondering if I broke something somewhere, causing these symptoms. I tried to delete the .pio folder, use a minimal platformio.ini, etc but the problems persist. Im losing my mind.
Is there a comprehensive guide explaining what include paths should look like for pio ? Eg if I have lib/lib1/foo.h , lib/lib2/bar.h, lib/lib2/utils/foobar.h, what would be the paths to include one from another ? The official documentation is rather elliptical.