Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 11 months ago.
Linker error when using the Nordics FlashDataStorage API's.
I am using the online compiler to compile against the NRF52_DK platform. Although there are no compilation errors while using the FDS api's. But I get the linker error below. I call the fds_register method from a custom c++ class TestFlashStorage.
Error: Undefined symbol fds_register(void(*)(const fds_evt_t*)) (referred from TestFlashStorage.NRF52_DK.o).
Can I not invoke FDS api's from c++ methods as shown below?
linker error:Undefined symbol fds_register
ret_code_t TestFlashStorage::Initialize() { ret_code_t ret = fds_register(&TestFlashStorage::OnFDSEvents); if (ret != FDS_SUCCESS) { logError("FDS Registration failed with error code: %d", ret); return ret; } return NRF_SUCCESS; }
Thanks, Yogesh
Question relating to:
1 Answer
7 years, 11 months ago.
Yes you can use fds from c++. You must make toolchain aware of that C code is called instead of C++: Use extern "c" statement in order to include fds header:
extern "C" { #include "fds.h" }
For clarification - because FDS is not a generic API for mbed-os it is not included by e.g. mbed.h. You can expect similar behaviour for other nordic's specific code.
Thanks a lot Andrzej, I had asked the same question to Nordic support and they told me FDS is not enabled and the FDS API is not supported in the MBED platform or rather not implemented. But I had looked up in the MBED-OS branch in github and I do see the FDS libarary.
Thanks for the simple fix you suggested and the linker error is gone. So I am assuming the FDS related libraries are compiled for the NRF52 target?
Thanks, Yogesh
posted by 27 Jan 2017