Compilation Problems: Not finding definitions from an already included file

m4l490n
Posts: 3
Joined: Thu May 17, 2018 4:39 pm

Compilation Problems: Not finding definitions from an already included file

Postby m4l490n » Thu May 17, 2018 5:01 pm

Hello

I have two components and both have the include directory on their respective folders, nevertheless, the compilation is complaining about some implicit declaration of functions that I reference in one component but that are defined in another component.

The components look like this inside the components folder:

component_a
|
+--- include
| |
| +--- comp_a.h
+--- comp_a.c
+--- component.mk

component_b
|
+--- include
| |
| +--- comp_b.h
+--- comp_b.c
+--- component.mk

The problem seems to be on the fact that in comp_b.c I'm referencing a macro that is inside comp_a.h. And I'm doing this because the definitions in comp_a.h are meant to be used across all the components in the project. Both component.mk are empty by what I understood reading the documentation.

But the thing is that I read in the documentation:
COMPONENT_ADD_INCLUDEDIRS: Paths, relative to the component directory, which will be added to the include search path for all components in the project. Defaults to include if not overridden.
So I'm expecting the definitions in comp_a.h to be visible to comp_b.c without any further modifications, is this right?

Or what do I need to do to avoid the error: implicit declaration of function error in compilation?

ESP_Angus
Posts: 1267
Joined: Sun May 08, 2016 4:11 am

Re: Compilation Problems: Not finding definitions from an already included file

Postby ESP_Angus » Fri May 18, 2018 2:04 am

m4l490n wrote: So I'm expecting the definitions in comp_a.h to be visible to comp_b.c without any further modifications, is this right?
Sorry if this is a silly question, but is there a line "#include <comp_a.h>" inside comp_b.c?

Is it possible there's another file named comp_a.h elsewhere in your project which is being included instead?

m4l490n
Posts: 3
Joined: Thu May 17, 2018 4:39 pm

Re: Compilation Problems: Not finding definitions from an already included file

Postby m4l490n » Fri May 18, 2018 2:26 am

Thanks for helping!

No, is not a silly question, actually, right after I posted the question I realized that I had commented out the #define while I was sorting out some other errors. After realizing this I un-commented the line and now everything is compiling just fine.

Return to “ESP32 IDF”

Who is online

Users browsing this forum: No registered users and 13 guests