Hi,
I'm beginning in C++ with someone else's code that I am changing to suit my purpose. After making my changes there are many compile errors. I have worked my way through most, but have had to play around a bit to correctly interpret the way some of the errors display. One error regards a function that has another function as an argument, and it seems when I call that function there is some mismatch between it and the one declared in the header:
code/ceelirf.cpp:362:61: error: no matching function for call to ‘ceelirf::NewtRoot(void (ceelirf::*)(ceelirf::ftuple&, reell, reell, reell), reell&, reell&, reell&)’
code/ceelirf.cpp:289:7: note: candidate is: reell ceelirf::NewtRoot(void (*)(ceelirf::ftuple&, reell, reell, reell), reell&, reell&, reell&)
fyi reell is a defined type, ftuple is structure, and ceelirf is the class. The two strings match except for what's in the parentheses after 'void'. One is 'ceelirf::*' while the other is just '*'. The declaration of NewtRoot in the header file is:
The definition of NewtRoot in .cpp file is:
|
reell ceelirf::NewtRoot(void (*funcd)(ftuple&, reell, reell, reell), reell& tguess,reell& C1,reell& C2)
|
The call of the function is
|
estSpikeTime[n]= NewtRoot(&ceelirf::FComplex, tguess,C1,C2);
|
Any ideas as to why I get the compile error? Is it really the mistmatch of the strings that gives the error? That would mean that from a function call of NewtRoot where the argument is a function of a particular class, the compiler is looking for a definition of NewtRoot where the first argument is also a member fucntion. But I thought arguments in function definitions are for defining the type, and a class membership criteria seems exraneous to that purpose. Am I wrong?
Thanks for reading,
Max