cancel
Showing results for 
Search instead for 
Did you mean: 

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

AndreasPA
Associate III

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) {

}

1 ACCEPTED SOLUTION

Accepted Solutions

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

JW

View solution in original post

2 REPLIES 2

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

JW

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