build issue

bmartin0
Posts: 33
Joined: Tue Aug 03, 2021 10:38 pm

build issue

Postby bmartin0 » Mon Sep 27, 2021 6:44 pm

Hello,
I have a 4.3 based project that has 1 main.c file and I've added 2 components, init.c/h and sensor.c/h. The include files are in separate headers in components\init and components\sensor folders. In the main program I can add init.h and sensor.h and get access to any of the code or defines in those headers. When I place a define as #define include "init.h" in the sensor.c file, I get a build error saying the folder does not exist.
Can anyone explain why I can include these header files into main.c but not into each other? I added the components with New>ESP IDF Components so I'm not sure how I can include these header files into something other than main.c.
Thanks

chegewara
Posts: 2210
Joined: Wed Jun 14, 2017 9:00 pm

Re: build issue

Postby chegewara » Mon Sep 27, 2021 6:51 pm

Code: Select all

#define include "init.h" // no such monster thing
In every component you should have CMakeLists.txt file to register component. When you are registering component you should also add "REQUIRES init" to tell cmake that sensor will use init component code.

https://docs.espressif.com/projects/esp ... ystem.html

bmartin0
Posts: 33
Joined: Tue Aug 03, 2021 10:38 pm

Re: build issue

Postby bmartin0 » Mon Sep 27, 2021 7:27 pm

That fixed it, thank you very much.

Who is online

Users browsing this forum: FrankJensen, sangk82 and 129 guests