Skip to content

Sketch using SdFat fails to link certain functions #184

@mweber-ovt

Description

@mweber-ovt

SdFat links correctly in the Arduino IDE. However, the use of certain functions in a sketch using SdFat results in linker errors as follows:

[100%] Linking CXX executable BGC_4G.elf
libmega_rawdata.a(rawdata.cpp.obj): In function `RAWDATA::store(EVENT, TrapStatus)':
/.../BGC_4G/lib/rawdata/rawdata.cpp:107: undefined reference to `FatFile::printField(int, char)'
collect2: error: ld returned 1 exit status

The recursive option is set for SdFat.

There is a header file SdFat/src/FatLib/FatFile.h which defines the prototypes for FatFile member functions including printField. However, the code for printField itself is in a file FatFilePrint.cpp. Moving it to the file FatFile.cpp eliminates the linker error but that seems like a dangerous workaround.

I am very new to CMake and I wonder if this is a bug or if anybody has a suggestion for what I could do to avoid this error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions