How to get Intellisense to notice a project-specific .h file from a ext. component?
Posted: Sun Jan 11, 2026 10:05 am
Hello!
I suspect this is a basic question, but I've spent a couple days trying to crack it.
I have an ESP-IDF project and an external component in the following dir tree (only including important bits):
espDir
-projectDir
- -CMakeLists.txt
- -mainDir
- - -CMakeLists.txt
- - -main.c
- - -projectConfig.h
-componentDir
- -CMakeLists.txt
- -(component .c and .h files)
All CMakeLists are correctly set up b/c the project compiles correctly.
I would like to have a "project-based" projectConfig.h file that would be able to be #included in the component .c files to change the compilation of the component on a project-by-project basis. Specifically, I'd like to #define a DEBUG constant that would make the component compile in debug mode, but ONLY for the project I'm working on, while all other projects that use the same component compile in non-DEBUG mode, say.
In other words, the project would have an .h file that would affect how the component .c files compile.
The only issue I'm stuck at is: how do I get IntelliSense to play ball? When I open a component .c file, it fails to find the projectConfig.h file and all #ifdef regions that rely on the DEBUG constant are faded out...
For context: the component directory is bare, only .c, .h and the cmake file in there. I have added ${CMAKE_SOURCE_DIR}/mainDir folder to the INCLUDE_DIRS of idf_register_component
What else could IntelliSense need to work?
Any pointers would be greatly appreciated, thank you!
I suspect this is a basic question, but I've spent a couple days trying to crack it.
I have an ESP-IDF project and an external component in the following dir tree (only including important bits):
espDir
-projectDir
- -CMakeLists.txt
- -mainDir
- - -CMakeLists.txt
- - -main.c
- - -projectConfig.h
-componentDir
- -CMakeLists.txt
- -(component .c and .h files)
All CMakeLists are correctly set up b/c the project compiles correctly.
I would like to have a "project-based" projectConfig.h file that would be able to be #included in the component .c files to change the compilation of the component on a project-by-project basis. Specifically, I'd like to #define a DEBUG constant that would make the component compile in debug mode, but ONLY for the project I'm working on, while all other projects that use the same component compile in non-DEBUG mode, say.
In other words, the project would have an .h file that would affect how the component .c files compile.
The only issue I'm stuck at is: how do I get IntelliSense to play ball? When I open a component .c file, it fails to find the projectConfig.h file and all #ifdef regions that rely on the DEBUG constant are faded out...
For context: the component directory is bare, only .c, .h and the cmake file in there. I have added ${CMAKE_SOURCE_DIR}/mainDir folder to the INCLUDE_DIRS of idf_register_component
What else could IntelliSense need to work?
Any pointers would be greatly appreciated, thank you!