I'm making some header files that I'll be using, so far I have 4, which are named: name.h
patrons.h
library.h
and book.h
. My problem is this: library.h
contains a book
object which is found in the book.h
class. patrons.h
contains objects found in the book.h
class. So most if not all of the class interact with each other in some way.
When I try to compile the header files I get this error:
patrons.h:12:20: error: #include nested too deeply
patrons.h:13:18: error: #include nested too deeply
patrons.h:14:19: error: #include nested too deeply
patrons.h:15:18: error: #include nested too deeply
patrons.h:16:21: error: #include nested too deeply
patrons.h:17:18: error: #include nested too deeply
In file included from name.h:18:0,
from library.h:16,
and this loops through and gives me the identical error for each file. I assume this is because the book.h
has an #include "library.h
and so does patrons.h
, so it causes a loop of some sorts. How do I fix this? I'm new to C++ so please excuse me if it is hard to understand.