problem with including header files

Oct 7, 2011 at 2:07pm
Hi guys

I have three header files: OFunction.h which includes a function called fitness(), mWin.h and GSolver.h which contain a class each. I included OFunction.h in mWin.h and used it there. But there problem is when I include mWin.h in GSolver.h, I can't use the function there. I get the error that 'fitness' identifier not found.

Does anyone know what's wrong there?
Oct 7, 2011 at 2:21pm
You should not depend on headers including other headers. If you need a header somewhere, manually include it. Double inclusions are prevented with header guards anyways.
Oct 7, 2011 at 2:29pm
Thanks a lot. I tried that too, but the problem is still there.

But there is one thing I should mention. The OFunction.h includes the definition of the function as well, it means it has no .cpp file. Could that be the problem?
Oct 7, 2011 at 2:58pm
Ok, just post what exactly you have.
Oct 7, 2011 at 3:48pm
Thanks a lot. It seems that was the problem. I took the definition to a cpp file and the problem was solved!
Topic archived. No new replies allowed.