MDE LPC11U24 feof Error

19 Jul 2012

I am attempting to get the SDHC file system up and running on the 11U24 Mbed board I have here. However, I am getting a really weird feof error (see below). The code works perfect for my LPC1768.

I am suspecting it has to do with binaries. I did remove all the mbed build files from the FatFileSystem and the SDHCFileSystem library imports.


Undefined symbol feof (referred from main.cpp.LPC11U24.o).

#include "mbed.h"
#include <string>
#include "SDHCFileSystem.h"
Serial pc(USBTX, USBRX); // tx, rx
SDFileSystem sd(p5, p6, p7, p8, "sd"); // mosi, miso, sclk, cs

unsigned char c;                          // a single byte buffer

int main() {

   FILE *fp = fopen("/sd/myfile.txt", "w");
   fprintf(fp, "\n\rHello World!\n\r");
    //FILE * fp = fopen("quotes.m", "r");
    FILE *fp2 = fopen("/sd/quotes.m", "r");
    if(fp2 == NULL) {
        error("Could not open file for read\n");
    while (!feof(fp2)){                        // while not end of file
        c=fgetc(fp2);                         // get a character/byte from the file
        pc.printf("%c",c); // and show it in hex format
    DIR *d;
    struct dirent *p;

    d = opendir("/sd");
    if (d != NULL) {
        while ((p = readdir(d)) != NULL) {
            printf(" - %s\n", p->d_name);
    } else {
        pc.printf("Could not open directory!\n");
16 Jul 2015

I have just met the same error and I am finding the reason too. Error: Undefined symbol feof (referred from main.cpp.NUCLEO_F411RE.o).