Type Conversion error while running C++ code in ubuntu
-
I am getting an Error while compiling `DESolver.cpp`
DESolver.cpp: In member function ‘void DESolver::Setup(double*, double*, int, double, double)’:
DESolver.cpp:57:24: error: cannot convert ‘DESolver::Best1Exp’ from type ‘void (DESolver::)(int)’ to type ‘StrategyFunction {aka void (DESolver::*)(int)}’
calcTrialSolution = Best1Exp; -
I am getting an Error while compiling `DESolver.cpp`
DESolver.cpp: In member function ‘void DESolver::Setup(double*, double*, int, double, double)’:
DESolver.cpp:57:24: error: cannot convert ‘DESolver::Best1Exp’ from type ‘void (DESolver::)(int)’ to type ‘StrategyFunction {aka void (DESolver::*)(int)}’
calcTrialSolution = Best1Exp;This appears to me to be a call taking a pointer to a function - it wants a pointer and didn't getting one. Add an ampersand and see how that works for you. This is a shot in the dark though because I do not see the code in its context or the prototype declaration of the function call in question. In other words, if you had posted more of the code you would likely receive a better answer.
-
This appears to me to be a call taking a pointer to a function - it wants a pointer and didn't getting one. Add an ampersand and see how that works for you. This is a shot in the dark though because I do not see the code in its context or the prototype declaration of the function call in question. In other words, if you had posted more of the code you would likely receive a better answer.
-
I am getting an Error while compiling `DESolver.cpp`
DESolver.cpp: In member function ‘void DESolver::Setup(double*, double*, int, double, double)’:
DESolver.cpp:57:24: error: cannot convert ‘DESolver::Best1Exp’ from type ‘void (DESolver::)(int)’ to type ‘StrategyFunction {aka void (DESolver::*)(int)}’
calcTrialSolution = Best1Exp; -
Instead of
calcTrialSolution = Best1Exp;
you have to write
calcTrialSolution = &DESolver::Best1Exp;
(so for all case statements, of cause)