Skip to main content
Visitor II
June 11, 2021
Solved

Including Fatfs.h into main.h causes a metric ton of issues

  • June 11, 2021
  • 1 reply
  • 973 views

Hello,

Doing some work using sd cards, and noticed that if i were to use the main.h file and have all my fatfs.h declared all the structs like FATFS / FIL / FRESULT spit out errors that theyre undefiend when cntrl clicking takes me to the file.

unknown type name 'FATFS' (same with the remainder structs)

if i instead make my own file in src called x.h and copy the same code over i get no issues.

Any ideas ?

Latest version of cubemx

a quick snippit of the setup code is

#include "stdint.h"

#include "fatfs.h"

 FATFS FS;

 FIL fil;

 FRESULT fres;

int MountReadSDCard(){

 //Mount SSD and copy over the files

 if ((fres = f_mount(&FS, "", 1)) == FR_OK) {

   /* Try to open file */

 HAL_Delay(50);

   if ((fres = f_open(&fil, "out.bin", FA_READ)) == FR_OK) {

}

    This topic has been closed for replies.
    Best answer by waclawek.jan

    Make sure the compiler knows the path to fatfs.h. Details depends on your particular toolchan, read the toolchain's manual.

    JW

    1 reply

    Super User
    June 11, 2021

    Make sure the compiler knows the path to fatfs.h. Details depends on your particular toolchan, read the toolchain's manual.

    JW

    AndreasPAAuthor
    Visitor II
    June 15, 2021

    Thanks, completely forgot about the PATH, honestly assumed that it would of already been in there