An error C2664: related problem, concerning (__cdecl *)
Posted on 2004-09-07
I essentially get this error when i try the following:
This is in my code. For those familiar with GAlib, this should be instantly recognizable (dimensionSize in this case gives the number of genes the genome will have, while the objectiveFunction is the function it will use to calculate its fitness
GA1DArrayGenome<float> genome(dimensionSize, objectiveFunction);
That line however generates the following error:
'__thiscall GA1DArrayGenome<float>::GA1DArrayGenome<float>(unsigned int,float (__cdecl *)(class GAGenome &),void *)' : cannot convert parameter
2 from 'float (class GAGenome &)' to 'float (__cdecl *)(class GAGenome &)'
And for reference, this is the default constructor from the GA1DArrayGenome.cpp class:
template <class T>
GA1DArrayGenome(unsigned int length, GAGenome::Evaluator f, void * u) :
ONE LAST PIECE of information. My line worked jsut fine when I had used a console for VC++. I tried now using it in a proper Win Application (a dialog) and I get that error. Any help will be greatly appreciated, but please, try to be specific and as elaborate as possible... thanks.