esp_vfs.h: No such file or directory

hoo_wave
Posts: 14
Joined: Mon Dec 11, 2023 2:57 am

esp_vfs.h: No such file or directory

Postby hoo_wave » Thu May 30, 2024 10:40 am

I include esp_vfs.h in my .c file.

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "esp_vfs.h"
#include "esp_vfs_fat.h"
#include "esp_system.h"

const char *base_path = "/spiflash";
static wl_handle_t s_wl_handle = WL_INVALID_HANDLE;
I also add the REQUIRES spi_flash in my CMakeLists.txt.

Code: Select all

idf_component_register(SRCS "pm_fatfs.c"
                    INCLUDE_DIRS "."
                    REQUIRES spi_flash fatfs esp_system wear_levelling)
both of these two files in the directory : /components/fatfs/

In my main directory, I also add REQUIRES fatfs in /main/CMakeLists.txt

Code: Select all

idf_component_register(SRCS "main.c"
                    INCLUDE_DIRS "."
                    REQUIRES driver Ymodem fatfs)
In VScode,as I press ctrl button and click on esp_vfs.h, it can jump to the file successfully.
The file in the path:
E:\esp\esp-idf\components\spi_flash\sim\stubs\vfs\include
How can I solve the fatal error?

RathiSonika
Posts: 11
Joined: Thu Jun 22, 2023 2:58 pm

Re: esp_vfs.h: No such file or directory

Postby RathiSonika » Mon Jun 03, 2024 7:11 am

I'm not sure why you're adding the esp_vfs.h file to the `esp-idf\components\spi_flash\sim\stubs\vfs\include` directory. It is present at `esp-idf/components/vfs/include/esp_vfs.h`. However regarding the "esp_vfs.h: No such file or directory" issue, you need to include the `spi_flash\sim\stubs\vfs\include` path in the INCLUDE_DIRS in your CMakeLists.txt, as this path is not currently included in your build system.

Who is online

Users browsing this forum: Bing [Bot] and 113 guests