Cannot find IDF_PATH/components
Posted: Thu May 22, 2025 12:53 am
Project fails to compile, cannot find esp_sleep.h. I am using ESP-IDF v5.4 in VSCode in Windows 11 Pro. I have never had a problem like this with other ESP-IDF projects. I believe this is a problem in c_cpp_properties.json (found in .vscode directory). And I think the problem ultimately arises from the not normal subdir structure and the various CMakeLists file (see below). Here is "includePath" from c_cpp_properties:
The first line, is underlined in red (error) and the error is:
When I use command palette to run "ESP-IDF: Doctor Command" it reports:
Here are the CMakeLists files:
Top (bb_epaper):
esp_idf: no CMakeLists file.
mini_epaper_s3:
main:
I don't know what other info I should include here. I hope this is enough - and not too much.
Code: Select all
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${workspaceFolder}/**"
],
It seems strange that there is no error with espIdfPathWin.Cannot find: "${env:IDF_PATH}/components/"
When I use command palette to run "ESP-IDF: Doctor Command" it reports:
The components are there (otherwise none of my other projects would compile). Also in file build/config.env it does showESP-IDF Path (idf.espIdfPath) C:<HOMEPATH>\esp\v5.4\esp-idf
However, this project is unusual because the app_main is not in the usual subdir and I've had to alter CMakeLists files from the normal. I am trying to build from code with directory structure bb_epaper/esp_idf/mini_epaper_s3/main (yes, the dir is esp_idf, not esp-idf)."IDF_PATH": "C:/Users/glenn/esp/v5.4/esp-idf"
Here are the CMakeLists files:
Top (bb_epaper):
Code: Select all
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(my_bb_paper)
add_subdirectory(esp_idf/mini_epaper_s3)
mini_epaper_s3:
Code: Select all
cmake_minimum_required(VERSION 3.16)
add_executable(my_app main/mini_epaper_s3.c)
Code: Select all
set(COMPONENT_SRCS "mini_epaper_s3.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
set(COMPONENT_REQUIRES soc nvs_flash ulp driver esp_hw_support)
register_component()
#
# ULP support additions to component CMakeLists.txt.
#
# 1. The ULP app name must be unique (if multiple components use ULP).
set(ulp_app_name ulp_${COMPONENT_NAME})
#
# 2. Specify all C and Assembly source files.
# Files should be placed into a separate directory (in this case, ulp/),
# which should not be added to COMPONENT_SRCS.
set(ulp_riscv_sources "ulp/main.c")
#
# 3. List all the component source files which include automatically
# generated ULP export file, ${ulp_app_name}.h:
set(ulp_exp_dep_srcs ${app_sources})
#
# 4. Call function to build ULP binary and embed in project using the argument
# values above.
ulp_embed_binary(${ulp_app_name} "${ulp_riscv_sources}" "${ulp_exp_dep_srcs}")