It is probably some stupid syntax mistake, i have the following class written in h file
#include "IGenticSolverHelper.h" template <class T> class GenericGeneticSolver { public: GenericGeneticSolver(IGenticSolverHelper<T>& helper, int generationSize) : mSolverHelper(helper) { mSolverHelper.GenerateFirstGeneration(0, generationSize, currentGeneration); } private : vector<T> currentGeneration; IGenticSolverHelper<T>& mSolverHelper; }; And then the following code :
#include "IGenticSolverHelper.h" #include "GenericGeneticSolver.h" class HelperImpl : IGenticSolverHelper<int> { public: void GenerateFirstGeneration(const int seed,const int generationSize, vector<int>& firstGeneration) { } void Crossover(const int& father,const int& mother, int& son) { } void Mutate(const int& orignal, int& mutated) { } float Cost(int& solution) { } }; int main() { int a =5; GenericGeneticSolver<int> mySolver(HelperImpl,a); } And i get the following error when i compile :
error C2061: syntax error : identifier 'a' if i will change the line to :
GenericGeneticSolver<int> mySolver(HelperImpl); it will compile, though the constructor expect 2 arguments, and will get the following warning :
warning C4930: 'GenericGeneticSolver<T> mySolver(HelperImpl)': prototyped function not called (was a variable definition intended?) And to add to the oddness, when i put a break point on this line, he won't stop there.
What am i doing wrong, i just trying to create an instance of GenericGeneticSolver