There are certain header files I can only include from main.c or else the compiler complains that the header file does not exist.
Examples of these header files are:
"nvs_flash.h"
Bluetooth files eg. "esp_bt.h", "esp_bt_main.h"
HTTPS Server files
Is there any reason why these files can only be included from main.c? Is this behavior expected or is the problem related to my project?
My project structure consists of the following structure:
- CMakeLists.txt
- Makefile
- sdkconfig
- main
- CMakeLists.txt
- component.mk
- main.c
- components
- component1
- component1.h
- component1.c
- CMakeLists.txt
Certain header files can only be imported from main.c
Re: Certain header files can only be imported from main.c
Hi letsbuild,
The CMake build system tracks dependencies between components, so components need to declare the other dependencies that they require. "main" component is the one exception to this rule, it automatically requires all the other components.
A full explanation can be found here: https://docs.espressif.com/projects/esp ... quirements
(This seems like a common source of confusion for people setting up their own CMake components for the first time. Is there anywhere that you think this should be mentioned more prominently? If so, please let us know and we will add it.)
Angus
The CMake build system tracks dependencies between components, so components need to declare the other dependencies that they require. "main" component is the one exception to this rule, it automatically requires all the other components.
A full explanation can be found here: https://docs.espressif.com/projects/esp ... quirements
(This seems like a common source of confusion for people setting up their own CMake components for the first time. Is there anywhere that you think this should be mentioned more prominently? If so, please let us know and we will add it.)
Angus
Re: Certain header files can only be imported from main.c
Hey ESP_Angus,
thank you very much for your reply. Adding "REQUIRES bt" to my CMake component fixed the issue.
I think the Build System documentation should contain a list of all possible components that you can REQUIRE.
I think two things could make it more clear:
1) The examples could add the REQUIRES necessary despite them not needing them because they are fully contained in the main component.
2) Having the documentation of each component specify how to include the component in non-main components.
The Build System documentation has a list of components that you do not have to manually add to CMake, but I haven't found a list of the components, and their corresponding name, that you have to add manually. Therefore despite knowing that a component has to be manually installed one might not be able to figure out exactly how to phrase it: should it be "REQUIRES bt" or REQUIRES "bluetooth"?
thank you very much for your reply. Adding "REQUIRES bt" to my CMake component fixed the issue.
I think the Build System documentation should contain a list of all possible components that you can REQUIRE.
I think two things could make it more clear:
1) The examples could add the REQUIRES necessary despite them not needing them because they are fully contained in the main component.
2) Having the documentation of each component specify how to include the component in non-main components.
The Build System documentation has a list of components that you do not have to manually add to CMake, but I haven't found a list of the components, and their corresponding name, that you have to add manually. Therefore despite knowing that a component has to be manually installed one might not be able to figure out exactly how to phrase it: should it be "REQUIRES bt" or REQUIRES "bluetooth"?
Who is online
Users browsing this forum: No registered users and 315 guests