Impossible to compile due to a missing library

I’m trying to understand ESP-MESH networks since I have to build a network with some ESP32 cards. So I’m trying some examples from Espressif oficial GitHub repository, but I’m having problems to compile this one in PlatformIO: https://github.com/espressif/esp-idf/blob/master/examples/mesh/internal_communication/main/mesh_main.c.
I’m getting this logout in the terminal: src/main.c:14:10: fatal error: mesh_light.h: No such file or directory so I’m pretty sure that’s because I don’t have such library. I have done some research about how to install such library, but haven’t had any succes solving it. Any idea of how to handle this problem? Someone that has already encountered the same issue?

Look into the include/ folder in the main folder.

I have an include directory, but inside I just have a README file, which I think was automatically generated by PlatformIO. As you can see here:
image

No, I was refering to the include/ folder in the main folder in the link you’ve posted above, https://github.com/espressif/esp-idf/tree/master/examples/mesh/internal_communication/main.

Okey, got it, in fact, there’s the lib that I need, so I should make a copy of that file and put it into my PlatformIO include folder?

Exactly. But you can also put it in the src/ folder, it has the same effect.

Perfect! Now I’m getting a lot of errors with variables like: CONFIG_MESH_TOPOLOGY, CONFIG_MESH_MAX_LAYER, CONFIG_MESH_CHANNEL, CONFIG_MESH_ROUTER_SSID, CONFIG_MESH_ROUTER_PASSWD, etc.
Since I’m using Visual Studio Code, if I pass the mouse cursor over these variables, a message saying that such identifier hasn’t been declared/defined. So I should declare them, but where? How? Using what?

These variables come from the Kconfig.projbuild file.

Make sure you’ve copied this file in the project’s src/ folder too, and run pio run -t menuconfig as documented for configuring these macros.

This of course only works in framework = espidf project, but since you’re linking to a ESP-IDF project, I assume you already have that basic setup.

I imagined it was something related to Kconfig.projbuild file, since I also tried to flash this project directly from the ESP-IDF shell and had to make the configuration with the idf.py menuconfig command, and noticed that such file was created just right after.
So I imagine pio run -t menuconfigis the Platform equivalent for idf.py menuconfig, is this correct?
If so, even if the settings were already modified using the ESP-IDF shell, they have to be reconfigured if switch then to use PlatformIO?
About the linking part, I think you are talking about this part, which I can say that is linked:
image

Yes. For consistency sake you should edit the KConfig of a ESP-IDF project managed by PlatformIO only with PlatformIO’s pio run -t menuconfig tool, not directly idf.py, as that tool in your path may come from a different esp-idf version and might generate incompatibilities.

1 Like

Okey, tout compris. Just one thing, the KConfig file in PlatformIO framework is called sdkconfi, as it’s the one generated atfer running the pio run -t menuconfig and setting the desired values. Having both files in different locations may cause some problems? For instance, I managed, thanks to your help, to build and upload the example. (I also had to unisntall and install PlatformIO, python3.9 wit the Add to PATH option and some ESP-IDF features in VSCode because the pio run -t menuconfig wouldn’t work as it should, but after that everything works smoothly).
Thank you so much for your help!