Page 1 of 1

Should f_findfirst be available when the define FF_USE_FIND is set?

Posted: Thu May 30, 2019 4:03 pm
by xgarbxgarb
I'm trying to build a directory lister using FatFs with VFS for an SD card reader.

I get an undefined reference error when I try to use f_findfirst even when I change the FF_USE_FIND define in ffconf.h

Should I be able to use f_findfirst in the Arduino IDE? Basic code below:

Code: Select all

#include "Arduino.h"
#include "driver/sdmmc_host.h"
#include "driver/sdmmc_defs.h"
#include "sdmmc_cmd.h"
#include "esp_vfs_fat.h"

static esp_err_t card_err;

void setup() {
  card_err = init_sdcard();

#ifdef FF_USE_FIND
  Serial.print("defined: ");
  Serial.println( FF_USE_FIND ); // shows 2 in the serial monitor

  FF_DIR* dp;
  FRESULT dj = f_opendir(dp, "/sdcard");

  FILINFO fno;

  fr = f_findfirst(dp, &fno, "", "*");  // errors with "undefined reference to `f_findfirst'"

  while (fr == FR_OK && fno.fname[0]) {
    printf("%s\n", fno.fname);
    fr = f_findnext(dp, &fno);