Page 1 of 1

undefined reference to `esp_vfs_fat_spiflash_mount

Posted: Tue May 09, 2017 3:06 pm
by Fugazi
trying to get the wear levelling example in espidf working in arduino

https://github.com/espressif/esp-idf/bl ... ple_main.c

Compiles under the espidf make

Add the Arduino component, receives an error regarding the variables in the line

const esp_vfs_fat_mount_config_t mount_config = {
.max_files = 4,
.format_if_mount_failed = true
};

which are the wrong way round - corrected that and it fails on :-

C:\Users\Fugazi\Documents\sloeber-workspace\wl\Release/../wl.ino:54: undefined reference to `esp_vfs_fat_spiflash_mount(char const*, char const*, esp_vfs_fat_mount_config_t const*, int*)'
C:\Users\Fugazi\Documents\sloeber-workspace\wl\Release/../wl.ino:79: undefined reference to `esp_vfs_fat_spiflash_unmount(char const*, int)'

Spent the whole day trying every which way possible to sort this, please someone help !!! ? :)

Thanks

Re: undefined reference to `esp_vfs_fat_spiflash_mount

Posted: Tue May 09, 2017 6:17 pm
by martinayotte
In your INO sketch, do you simply include the "esp_vfs_fat.h" ?
In such case, linker try to find the functions as C++ not C, and there are not in the library ...
You need to include it that way :

Code: Select all

extern "C" {
    #include "esp_vfs_fat.h"
}

Re: undefined reference to `esp_vfs_fat_spiflash_mount

Posted: Tue May 09, 2017 10:11 pm
by Fugazi
Thanks !!

Totally forgot that :)

Should be ok now!