Page 1 of 1
A project with a component that requires another component
Posted: Mon Dec 09, 2019 1:33 pm
by mrdebug
Hi, I have a project with a component called component01.
The component requires
#include "mbedtls/base64.h"
When I try to compile I obtain this error:
fatal error: mbedtls/base64.h: No such file or directory
but the error does not happens if I add the same include in main.c
How can I use the header
#include "mbedtls/base64.h"
in my component01?
Re: A project with a component that requires another component
Posted: Mon Dec 09, 2019 2:17 pm
by PeterR
You would need to post your make files and a screen grab of your folder structure.
I have not used mbedtls but you include most esp components without directory path e.g.
Code: Select all
#include "esp_spiffs.h"
#include "esp_vfs_httpfs.h"
#include "esp_vfs.h"
#include "esp_vfs_fat.h"
For this to work the component (esp or your own) must be in /components
Re: A project with a component that requires another component
Posted: Mon Dec 09, 2019 3:06 pm
by mrdebug
Please try to download this
http://www.denisgottardello.it/Test02.zip
and have a look at the behaviour.
As you can see the
#include "mbedtls/base64.h"
works in main.c but not in test01.h of the component
Re: A project with a component that requires another component
Posted: Mon Dec 09, 2019 5:04 pm
by PeterR
I haven't switched to CMake yet but as an Gnu build you are missing component.mk is the component directory.
That may help.
Re: A project with a component that requires another component
Posted: Mon Dec 09, 2019 5:21 pm
by mrdebug
How do you think I should populate the component.mk file in order to include mbedtls module?
Re: A project with a component that requires another component
Posted: Tue Dec 10, 2019 4:24 am
by ESP_Angus
If you're using CMake (or idf.py) then you don't need a component.mk file at all, just CMakeLists.txt.
In the CMake based build system, components need to declare their dependencies. So "component01" needs to declare that it requires the "mbedtls" component in order to include headers found in the mbedtls component.
To learn more, read here:
https://docs.espressif.com/projects/esp ... quirements