0

I keep getting this error: QuadraticProbing.h:54:22: error: ‘Human’ has not been declared int hash(Human &human, int tableSize );

However, in QuadraticProbing.h, I #include at the top familytree.h, in which the class Human is declared. Does anyone know why I am still getting compilation errors? I think it has to do with multiple redefinition, because in familytree.h, I also #include QuadraticProbing.h because I use some of those functions in the corresponding.cpp file. Here is what I have at the top of each file. Any input would be greatly appreciated!! =]

    #ifndef _QUADRATIC_PROBING_H_
    #define _QUADRATIC_PROBING_H_

    #include "vector.h"
    #include "mystring.h"
    #include "familytree.h"
    ----------------------
    #ifndef FAMILYTREE_H
    #define FAMILYTREE_H
    #include "QuadraticProbing.h"
    #include "familyRunner.h"
Kevin Cheng
  • 115
  • 1
  • 4
  • 1
    You have a *circular dependency*, the header file `QuadraticProbing.h` depends on the header file `familytree.h` which depends on `QuadraticProbing.h` and so on. Instead of including the header files into each other, just declare the classes, so in `QuadraticProbing.h` you do e.g. `class Human;` – Some programmer dude Feb 22 '15 at 06:31
  • You probably need to do a forward declaration of class Human. – Luca Feb 22 '15 at 06:55
  • what do you mean by that? – Kevin Cheng Feb 22 '15 at 07:18

0 Answers0