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.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Hi all. I am having trouble attaching my object/method to FunctionPointer. I passed the two objects msExt and cfExt to the exeFunc class. Compilation error: no instance of overloaded function "mbed::FunctionPointer::attach" matches the argument list. That error points to code:_p.attach(_cfExt, _cfExt.checkConfigForFirstStart());
I do have a basic understanding of the meaning to that error(so I think). I have tried a few edits to that line, but I still arrive at compile errors. Is what I am attempting to accomplish not going to work and that I should create a separate function inside the exeFunc class then attach that?
main.cpp code:
#include "mbed.h" #include "MODSERIAL.h" #include "ConfigFile.h" #include "msExtensions.h" #include "cfExtensions.h" #include "exeFunc.h" #include "phSensor.h" MODSERIAL pc(USBTX, USBRX); msExtensions msExt = msExtensions(pc); cfExtensions cfExt = cfExtensions(msExt); phSensor phS = phSensor(cfExt, msExt); exeFunc exeCmd = exeFunc(msExt, cfExt); int main() { //cfExt.checkConfigForFirstStart(); while(1) { } }exeFunc.h code:
class exeFunc { public: exeFunc(msExtensions &msExt, cfExtensions &cfExt); private: void _splitFuncFromCmd(); void _attachCallback(); msExtensions &_msExt; cfExtensions &_cfExt; FunctionPointer _p; };exeFunc.cpp code exert:
exeFunc::exeFunc(msExtensions &msExt, cfExtensions &cfExt) : _msExt(msExt), _cfExt(cfExt) { _p.attach(_cfExt, _cfExt.checkConfigForFirstStart()); }